123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import 'package:shared/utils/date_time_utils.dart';
- import 'package:widgets/load_state_layout.dart';
- import 'visitTimeType.dart';
- class ChooseVisitTimeContentState{
- // 当前所选中的所有时间段集合
- List<VisitTimeContentItem> get allSelectedTimeList => visitTimeList.where((item) => item.isChecked??false).toList();
- //页面 LoadView 状态的展示
- LoadState loadingState;
- String? errorMessage;
- // 是否可多选
- bool? isMultiSelect;
- List<VisitTimeContentItem> 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<VisitTimeContentItem>? visitTimeList,
- }) {
- this.visitTimeList = visitTimeList ?? [];
- }
- ChooseVisitTimeContentState copyWith({
- LoadState? loadingState,
- String? errorMessage,
- bool? isMultiSelect,
- List<VisitTimeContentItem>? 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<String, dynamic>? 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,
- );
- }
- }
|