12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import 'package:cs_resources/generated/l10n.dart';
- import 'package:flutter/material.dart';
- class ProfileEditState{
- //表单的校验与数据
- final Map<String, Map<String, dynamic>> formData;
- String? avatarPath; //头像的路径或Uri
- // =================================== Begin ↓ ===================================
- ProfileEditState({
- Map<String, Map<String, dynamic>>? formData,
- this.avatarPath,
- }) : formData = formData ??
- {
- 'first_name': {
- 'value': '',
- 'controller': TextEditingController(),
- 'hintText': S.current.first_name,
- 'focusNode': FocusNode(),
- 'obsecure': false,
- },
- 'last_name': {
- 'value': '',
- 'controller': TextEditingController(),
- 'hintText': S.current.last_name,
- 'focusNode': FocusNode(),
- 'obsecure': false,
- },
- 'email': {
- 'value': '',
- 'controller': TextEditingController(),
- 'hintText': S.current.email,
- 'focusNode': FocusNode(),
- 'obsecure': false,
- },
- };
- ProfileEditState copyWith({
- String? avatarPath,
- }) {
- return ProfileEditState(
- formData: this.formData,
- avatarPath: avatarPath ?? this.avatarPath,
- );
- }
- }
|