import 'package:cs_resources/generated/l10n.dart'; import 'package:flutter/material.dart'; class ProfileEditState{ //表单的校验与数据 final Map> formData; List? defaultAvatars; //默认头像 String? avatarPath; //头像的路径或Uri // =================================== Begin ↓ =================================== ProfileEditState({ Map>? formData, this.avatarPath, this.defaultAvatars, }) : 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, List? defaultAvatars, }) { return ProfileEditState( formData: this.formData, avatarPath: avatarPath ?? this.avatarPath, defaultAvatars: defaultAvatars ?? this.defaultAvatars, ); } }