import 'package:widgets/load_state_layout.dart'; import 'visitTimeType.dart'; class ChooseVisitTimeContentState{ // 设置一个get totalPrice get totalPrice => visitTimeList.map((item) => (item.isChecked??false) ? item.price??0 : 0 ).reduce((before, current) => before + current); //页面 LoadView 状态的展示 LoadState loadingState; String? errorMessage; List visitTimeList = []; ChooseVisitTimeContentState({ this.loadingState = LoadState.State_Loading, this.errorMessage, required this.visitTimeList, }); ChooseVisitTimeContentState copyWith({ LoadState? loadingState, String? errorMessage, List? visitTimeList, }){ return ChooseVisitTimeContentState( loadingState: loadingState??this.loadingState, errorMessage: errorMessage??this.errorMessage, visitTimeList: visitTimeList??this.visitTimeList, ); } } class VisitTimeContentItem{ String? name; int? id; double? price; Map? type; bool? isChecked; bool? isDisable; VisitTimeContentItem({ this.name, this.id, this.price, this.type, this.isChecked = false, this.isDisable = false, }); VisitTimeContentItem copyWith({ String? name, int? id, double? price, Map? type, bool? isChecked, bool? isDisable, }){ return VisitTimeContentItem( name: name??this.name, id: id??this.id, price: price??this.price, type: type ?? this.type, // 在这里设置默认值 isChecked: isChecked??this.isChecked, isDisable: isDisable??this.isDisable, ); } }