1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- class ChooseAirConditionContentState{
- // 设置一个get totalPrice
- get totalPrice => airConditionList.map((item) => (item.num??0) * (item.price??0)).reduce((before, current) => before + current);
- List<AirConditionContentItem> airConditionList = [];
- ChooseAirConditionContentState({
- required this.airConditionList,
- });
- ChooseAirConditionContentState copyWith({
- List<AirConditionContentItem>? airConditionList,
- }){
- return ChooseAirConditionContentState(
- airConditionList: airConditionList??this.airConditionList,
- );
- }
- }
- class AirConditionContentItem{
- String? name;
- int? id;
- int? num;
- double? price;
- AirConditionContentItem({
- this.name,
- this.id,
- this.num,
- this.price
- });
- AirConditionContentItem copyWith({
- String? name,
- int? id,
- int? num,
- double? price
- }){
- return AirConditionContentItem(
- name: name??this.name,
- id: id??this.id,
- num: num??this.num,
- price: price??this.price
- );
- }
- }
|