import 'package:cs_resources/generated/l10n.dart'; import 'package:flutter/material.dart'; class FeedbackCreateState { //表单的校验与数据 final Map> formData; //表单的错误信息展示 String? titleErrorText; //类型选项 final List optionList = ["条件1", "条件2", "条件3", "条件4"]; String? selectedOption; //选择的图片 List imgList; // =================================== Begin ↓ =================================== FeedbackCreateState({ Map>? formData, this.titleErrorText, required this.imgList, this.selectedOption, }) : formData = formData ?? { 'title': { 'value': '', 'controller': TextEditingController(), 'focusNode': FocusNode(), 'obsecure': false, }, 'desc': { 'value': '', 'controller': TextEditingController(), 'focusNode': FocusNode(), 'hintText': S.current.type_here, 'obsecure': false, }, }; FeedbackCreateState copyWith({ String? titleErrorText, String? selectedOption, List? imgList, }) { return FeedbackCreateState( formData: this.formData, titleErrorText: titleErrorText, imgList: imgList ?? this.imgList, selectedOption: selectedOption ?? this.selectedOption, ); } }