import 'package:shared/utils/date_time_utils.dart'; import 'package:widgets/load_state_layout.dart'; import 'visitTimeType.dart'; class ChooseVisitTimeContentState{ // 当前所选中的所有时间段集合 List get allSelectedTimeList => visitTimeList.where((item) => item.isChecked??false).toList(); //页面 LoadView 状态的展示 LoadState loadingState; String? errorMessage; // 是否可多选 bool? isMultiSelect; List visitTimeList = []; String currentDate = DateTimeUtils.formatDate(DateTime.now(), format: "yyyy-MM-dd"); ChooseVisitTimeContentState({ this.loadingState = LoadState.State_Loading, this.errorMessage, this.isMultiSelect = false, required this.currentDate, List? visitTimeList, }) { this.visitTimeList = visitTimeList ?? []; } ChooseVisitTimeContentState copyWith({ LoadState? loadingState, String? errorMessage, bool? isMultiSelect, List? visitTimeList, String? currentDate, }) { return ChooseVisitTimeContentState( loadingState: loadingState ?? this.loadingState, errorMessage: errorMessage ?? this.errorMessage, isMultiSelect: isMultiSelect ?? this.isMultiSelect, visitTimeList: visitTimeList ?? this.visitTimeList, currentDate: currentDate ?? this.currentDate, ); } } class VisitTimeContentItem{ int? id; String? timeText; String? time; bool? urgent; bool? holiday; bool? night; bool? isChecked; bool? enable; VisitTimeContentItem({ this.id, this.timeText, this.time, this.urgent, this.holiday, this.night, this.isChecked = false, this.enable = false, }); VisitTimeContentItem copyWith({ String? name, int? id, Map? type, bool? isChecked, bool? enable, }){ return VisitTimeContentItem( id: id??this.id, timeText: timeText??this.timeText, time: time??this.time, urgent: urgent??this.urgent, holiday: holiday??this.holiday, night: night??this.night, isChecked: isChecked??this.isChecked, enable: enable??this.enable, ); } }