import 'package:cs_resources/generated/l10n.dart'; import 'package:domain/entity/id_name_entity.dart'; import 'package:flutter/material.dart'; class FeedbackCreateState { //表单的校验与数据 final Map> formData; //类型选项 List? optionList; IdNameEntity? selectedOption; //选择的图片 List imgList; // =================================== Begin ↓ =================================== FeedbackCreateState({ Map>? formData, required this.imgList, this.optionList, 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({ List? optionList, IdNameEntity? selectedOption, List? imgList, }) { return FeedbackCreateState( formData: this.formData, imgList: imgList ?? this.imgList, optionList: optionList ?? this.optionList, selectedOption: selectedOption ?? this.selectedOption, ); } }