import 'package:cs_resources/generated/l10n.dart'; import 'package:flutter/material.dart'; class ChangeMobileState { //表单的校验与数据 final Map> formData; //获取验证码的倒计时 bool isOldCounting; int oldCountdownTime; bool isNewCounting; int newCountdownTime; //表单的错误信息展示 String? oldCodeErrorText; String? newCodeErrorText; // =================================== Begin ↓ =================================== ChangeMobileState({ Map>? formData, this.isOldCounting = false, this.oldCountdownTime = 0, this.isNewCounting = false, this.newCountdownTime = 0, this.oldCodeErrorText, this.newCodeErrorText, }) : formData = formData ?? { 'old': { 'value': '', 'controller': TextEditingController(), 'hintText': S.current.mobile_phone, 'focusNode': FocusNode(), 'obsecure': false, }, 'old_code': { 'value': '', 'controller': TextEditingController(), 'hintText': S.current.verification_code, 'focusNode': FocusNode(), 'obsecure': false, }, 'new': { 'value': '', 'controller': TextEditingController(), 'hintText': S.current.mobile_phone, 'focusNode': FocusNode(), 'obsecure': false, }, 'new_code': { 'value': '', 'controller': TextEditingController(), 'hintText': S.current.verification_code, 'focusNode': FocusNode(), 'obsecure': false, }, }; ChangeMobileState copyWith({ bool? isOldCounting, int? oldCountdownTime, bool? isNewCounting, int? newCountdownTime, String? oldCodeErrorText, String? newCodeErrorText, }) { return ChangeMobileState( formData: this.formData, isOldCounting: isOldCounting ?? this.isOldCounting, oldCountdownTime: oldCountdownTime ?? this.oldCountdownTime, isNewCounting: isNewCounting ?? this.isNewCounting, newCountdownTime: newCountdownTime ?? this.newCountdownTime, oldCodeErrorText: oldCodeErrorText, newCodeErrorText: newCodeErrorText, ); } }