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