123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:riverpod_annotation/riverpod_annotation.dart';
- import 'package:router/ext/auto_router_extensions.dart';
- import 'package:shared/utils/log_utils.dart';
- import 'package:widgets/dialog/dialog_content_wrap.dart';
- import '../../../respository/services_respository.dart';
- import 'chooseHouseCleanContent_state.dart';
- part 'chooseHouseCleanContent_vm.g.dart';
- List<Map<String, dynamic>> HouseCleanList = [
- {
- "name": "House Clean 1(unit)",
- "id": 1,
- "price": 40.0,
- "num":1,
- "areaSizeRange": "≤600 sqft",
- "isChecked": false,
- "isDisable": false,
- },
- {
- "name": "House Clean 2(unit)",
- "id": 2,
- "price": 57.0,
- "num":1,
- "areaSizeRange": "601-800 sqft",
- "isChecked": false,
- "isDisable": false,
- },
- {
- "name": "House Clean 3(unit)",
- "id": 3,
- "price": 72.0,
- "num":1,
- "areaSizeRange": "801-1000 sqft",
- "isChecked": false,
- "isDisable": false,
- },
- {
- "name": "House Clean 3(unit)",
- "id": 4,
- "price": 85.0,
- "num":1,
- "areaSizeRange": "1001-1200 sqft",
- "isChecked": false,
- "isDisable": false,
- },
- ];
- @riverpod
- class ChooseHouseCleanContentVm extends _$ChooseHouseCleanContentVm {
- late ServicesRespository serviceRespositoryInstance;
- late BuildContext _context;
- late Map<String, dynamic>? _initProps;
- ChooseHouseCleanContentState initState(){
- Log.d("--------------------------initState---------------------");
- List<HouseCleanContentItem> HouseCleanListNew = [];
- HouseCleanList.forEach((item) {
- HouseCleanContentItem newItem = HouseCleanContentItem()
- ..id = item['id']
- ..price = item['price'] as double
- ..name = item['name']
- ..num = 1
- ..areaSizeRange = item['areaSizeRange']
- ..isChecked = item['isChecked']
- ..isDisable = item['isDisable'];
- HouseCleanListNew.add(newItem);
- });
- return ChooseHouseCleanContentState(
- HouseCleanList: HouseCleanListNew,
- );
- }
- @override
- ChooseHouseCleanContentState build(){
- // 引入数据仓库
- serviceRespositoryInstance = ref.read(servicesRespositoryProvider);
- ChooseHouseCleanContentState state = initState();
- Log.d("--------------------------build---------------------");
- return state;
- }
- setInitPageData(BuildContext context, Map<String, dynamic>? params){
- _context = context;
- Log.d("--------------------------setInitPageData----------$params-----------");
- _initProps = params;
- }
- handlerChangeNum(BuildContext context, bool isChecked, int index){
- state.HouseCleanList[index].isChecked = isChecked;
- state = state.copyWith(
- HouseCleanList: state.HouseCleanList,
- );
- }
- }
|