1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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<VisitTimeContentItem> visitTimeList = [];
- ChooseVisitTimeContentState({
- this.loadingState = LoadState.State_Loading,
- this.errorMessage,
- required this.visitTimeList,
- });
- ChooseVisitTimeContentState copyWith({
- LoadState? loadingState,
- String? errorMessage,
- List<VisitTimeContentItem>? visitTimeList,
- }){
- return ChooseVisitTimeContentState(
- loadingState: loadingState??this.loadingState,
- errorMessage: errorMessage??this.errorMessage,
- visitTimeList: visitTimeList??this.visitTimeList,
- );
- }
- }
- class VisitTimeContentItem{
- String? name;
- int? id;
- double? price;
- Map<String, dynamic>? 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<String, dynamic>? 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,
- );
- }
- }
|