123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import 'package:cpt_services/components/chooseVisitTimeBottomFooter.dart';
- import 'package:cpt_services/components/chooseVisitTimeTitle_vm.dart';
- import 'package:cpt_services/modules/services/service_clean_detail/service_clean_detail_vm.dart';
- import 'package:cs_resources/theme/app_colors_theme.dart';
- import 'package:flutter/material.dart';
- import 'package:auto_route/auto_route.dart';
- import 'package:flutter_hooks/flutter_hooks.dart';
- import 'package:hooks_riverpod/hooks_riverpod.dart';
- import 'package:shared/utils/color_utils.dart';
- import 'package:shared/utils/log_utils.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_text_view.dart';
- import 'package:widgets/widget_export.dart';
- import 'chooseVisitTimeTitle_state.dart';
- import 'chooseVisitTimeTitle_vm.dart';
- class ChooseVisitTimeTitle extends HookConsumerWidget {
- final int id;
- final String cleanServiceType;
- const ChooseVisitTimeTitle(
- {Key? key,required this.id, required this.cleanServiceType,}) : super(key: key);
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final vm = ref.read(chooseVisitTimeTitleVmProvider.notifier);
- final state = ref.watch(chooseVisitTimeTitleVmProvider);
- List<DayInfoItem> dayInfoList = ref.watch(chooseVisitTimeTitleVmProvider.select((state) => state.dayInfoList))?? [];
- useEffect((){
- // 组件挂载时执行 - 执行接口请求
- // Future.microtask(() => vm.initPageData());
- return () {
- // 组件卸载时执行
- };
- },[]);
- return Container(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.only(left: 20, right: 20, top: 19, bottom: 16.5),
- child: Column(
- children: [
- MyTextView(
- "Please choose a visit time",
- textColor: context.appColors.textBlack,
- textAlign: TextAlign.left,
- isFontBold: true,
- fontSize: 17,
- boxWidth: double.infinity,
- // maxLines: 5,
- ),
- ],
- ),
- ),
- Container(
- width: double.infinity,
- height: 65,
- // color: Colors.red,
- margin: const EdgeInsets.only(left: 20, right: 20, top: 0, bottom: 0),
- child: ListView.builder(
- itemCount: dayInfoList.length,
- shrinkWrap: true,
- scrollDirection: Axis.horizontal,
- itemBuilder: (context, index){
- DayInfoItem item = dayInfoList[index];
- return Container(
- width: 100,
- height: 65,
- decoration: BoxDecoration(
- color: item.isSelected ? ColorUtils.string2Color('#F5F5F7'): context.appColors.whiteBG,
- borderRadius: const BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- MyTextView(
- "${item.day}",
- textColor: context.appColors.textBlack,
- fontSize: 12,
- isFontBold: true,
- ),
- MyTextView(
- "${item.date}",
- textColor: context.appColors.textBlack,
- fontSize: 12,
- isFontBold: true,
- marginTop: 5,
- ),
- ]
- )
- ).onTap((){
- // 点击某一天
- vm.handlerClicKSomeDay(context, item, index);
- });
- }
- ),
- ),
- // 分割线
- Divider(
- color: context.appColors.grayBgE9,
- height: 1,
- ),
- ],
- ),
- );
- }
- }
|