123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- class ChooseHouseCleanContentState{
- // 设置一个get totalPrice
- // 设置一个get totalPrice
- get totalPrice => HouseCleanList.map((item) => (item.isChecked ?? false) ? (item.num ?? 1) * (item.price ?? 0) : 0).reduce((before, current) => before + current);
- List<HouseCleanContentItem> HouseCleanList = [];
- ChooseHouseCleanContentState({
- required this.HouseCleanList,
- });
- ChooseHouseCleanContentState copyWith({
- List<HouseCleanContentItem>? HouseCleanList,
- }){
- return ChooseHouseCleanContentState(
- HouseCleanList: HouseCleanList??this.HouseCleanList,
- );
- }
- }
- class HouseCleanContentItem{
- String? name;
- String? areaSizeRange;
- int? id;
- int? num;
- double? price;
- bool? isChecked;
- bool? isDisable;
- HouseCleanContentItem({
- this.name,
- this.areaSizeRange,
- this.id,
- this.num,
- this.price,
- this.isChecked = false,
- this.isDisable = false,
- });
- HouseCleanContentItem copyWith({
- String? name,
- String? areaSizeRange,
- int? id,
- int? num,
- double? price,
- bool? isChecked,
- bool? isDisable,
- }){
- return HouseCleanContentItem(
- name: name??this.name,
- areaSizeRange: areaSizeRange??this.areaSizeRange,
- id: id??this.id,
- num: num??this.num,
- price: price??this.price,
- isChecked: isChecked??this.isChecked,
- isDisable: isDisable??this.isDisable
- );
- }
- }
|