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