class ChooseHouseCleanContentState{ // totalPrice get totalPrice => houseCleanList?.map((item) => (item.isChecked ?? false) ? (item.num ?? 1) * (item.price ?? 0) : 0).reduce((before, current) => before + current)?? 0; // hasCheckdService get hasCheckdService => houseCleanList?.any((item) => (item.isChecked ?? false)) ?? false; // 选取的服务项目 get checkedServiceList => houseCleanList?.where((item) => (item.isChecked ?? false))?.toList() ?? []; List? houseCleanList; ChooseHouseCleanContentState({ required this.houseCleanList, }); ChooseHouseCleanContentState copyWith({ List? 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 ); } }