123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import 'package:cs_resources/generated/l10n.dart';
- import 'package:flutter/material.dart';
- class SignUpState {
- //表单的校验与数据
- final Map<String, Map<String, dynamic>> formData;
- //表单的错误信息展示
- String? firstNameErrorText;
- String? lastNameErrorText;
- String? emailErrorText;
- String? phoneErrorText;
- String? passwordErrorText;
- String? confirmPasswordErrorText;
- //是否明文展示密码
- bool pwdVisibility;
- bool confirmPwdVisibility;
- bool isAgreeTerms;
- // =================================== Begin ↓ ===================================
- SignUpState({
- Map<String, Map<String, dynamic>>? formData,
- this.pwdVisibility = false,
- this.confirmPwdVisibility = false,
- this.isAgreeTerms = false,
- this.firstNameErrorText,
- this.lastNameErrorText,
- this.emailErrorText,
- this.phoneErrorText,
- this.passwordErrorText,
- this.confirmPasswordErrorText,
- }) : 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,
- },
- 'phone': {
- 'value': '',
- 'controller': TextEditingController(),
- 'hintText': S.current.mobile_phone,
- 'focusNode': FocusNode(),
- 'obsecure': false,
- },
- 'password': {
- 'value': '',
- 'controller': TextEditingController(),
- 'hintText': S.current.password,
- 'focusNode': FocusNode(),
- 'obsecure': true,
- },
- 'confirm_password': {
- 'value': '',
- 'controller': TextEditingController(),
- 'hintText': S.current.confirm_password,
- 'focusNode': FocusNode(),
- 'obsecure': true,
- },
- };
- SignUpState copyWith({
- String? firstNameErrorText,
- String? lastNameErrorText,
- String? emailErrorText,
- String? phoneErrorText,
- String? passwordErrorText,
- String? confirmPasswordErrorText,
- bool? pwdVisibility,
- bool? confirmPwdVisibility,
- bool? isAgreeTerms,
- }) {
- return SignUpState(
- formData: this.formData,
- isAgreeTerms: isAgreeTerms ?? this.isAgreeTerms,
- pwdVisibility: pwdVisibility ?? this.pwdVisibility,
- confirmPwdVisibility: confirmPwdVisibility ?? this.confirmPwdVisibility,
- firstNameErrorText: firstNameErrorText,
- lastNameErrorText: lastNameErrorText,
- emailErrorText: emailErrorText,
- phoneErrorText: phoneErrorText,
- passwordErrorText: passwordErrorText,
- confirmPasswordErrorText: confirmPasswordErrorText,
- );
- }
- }
|