1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import 'package:cs_resources/generated/l10n.dart';
- import 'package:flutter/material.dart';
- class ChangeMobileState {
- //表单的校验与数据
- final Map<String, Map<String, dynamic>> formData;
- //获取验证码的倒计时
- bool isOldCounting;
- int oldCountdownTime;
- bool isNewCounting;
- int newCountdownTime;
- //表单的错误信息展示
- String? oldCodeErrorText;
- String? newCodeErrorText;
- // =================================== Begin ↓ ===================================
- ChangeMobileState({
- Map<String, Map<String, dynamic>>? 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,
- );
- }
- }
|