chooseVisitTimeBottomFooter.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import 'package:cpt_services/components/chooseVisitTimeBottomFooter_vm.dart';
  2. import 'package:cpt_services/components/chooseVisitTimeContent_vm.dart';
  3. import 'package:cpt_services/components/status_card_item.dart';
  4. import 'package:cs_resources/theme/app_colors_theme.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:auto_route/auto_route.dart';
  7. import 'package:flutter_hooks/flutter_hooks.dart';
  8. import 'package:hooks_riverpod/hooks_riverpod.dart';
  9. import 'package:shared/utils/log_utils.dart';
  10. import 'package:widgets/ext/ex_widget.dart';
  11. import 'package:widgets/my_text_view.dart';
  12. import 'package:widgets/widget_export.dart';
  13. import 'package:widgets/my_cart_num.dart';
  14. import '../modules/services/service_order_confirm/service_order_confirm_vm.dart';
  15. class ChooseVisitTimeBottomFooter extends HookConsumerWidget {
  16. final int id;
  17. final String cleanServiceType;
  18. const ChooseVisitTimeBottomFooter({Key? key,required this.id, required this.cleanServiceType}) : super(key: key);
  19. @override
  20. Widget build(BuildContext context, WidgetRef ref) {
  21. final vm = ref.read(chooseVisitTimeBottomFooterVmProvider.notifier);
  22. final state = ref.watch(chooseVisitTimeBottomFooterVmProvider);
  23. double toTalPrice = ref.watch(serviceOrderConfirmVmProvider.select((state) => state.totalPrice??0.0));
  24. useEffect((){
  25. // 组件挂载时执行 - 执行接口请求
  26. // Future.microtask(() => vm.initPageData());
  27. return () {
  28. // 组件卸载时执行
  29. };
  30. },[]);
  31. return Container(
  32. height: 50,
  33. width: double.infinity,
  34. child: Row(
  35. mainAxisAlignment: MainAxisAlignment.center,
  36. mainAxisSize: MainAxisSize.max,
  37. children: [
  38. Container(
  39. constraints: const BoxConstraints(
  40. minWidth: 122,
  41. ),
  42. child: Row(
  43. mainAxisAlignment: MainAxisAlignment.center,
  44. crossAxisAlignment: CrossAxisAlignment.center,
  45. mainAxisSize: MainAxisSize.max,
  46. children: [
  47. Container(
  48. alignment: Alignment.center,
  49. padding: const EdgeInsets.only(left:5, right: 0,top:5,bottom: 5),
  50. child: Row(
  51. mainAxisAlignment: MainAxisAlignment.center,
  52. mainAxisSize: MainAxisSize.max,
  53. children: [
  54. MyTextView(
  55. "\$$toTalPrice",
  56. fontSize: 18,
  57. textColor: Colors.white,
  58. isFontRegular: true,
  59. maxLines:2,
  60. isTextEllipsis: true,
  61. marginLeft: 5,
  62. marginRight: 15,
  63. ),
  64. ],
  65. ),
  66. ),
  67. ],
  68. ).backgroundColor(context.appColors.textPrimary),
  69. ),
  70. Expanded(
  71. child: Container(
  72. color: context.appColors.redDefault,
  73. child: Center(
  74. child: MyTextView(
  75. 'Confirm',
  76. textColor: context.appColors.textWhite,
  77. fontSize: 17,
  78. isFontMedium: true,
  79. textAlign: TextAlign.center,
  80. ),
  81. ),
  82. ).onTap((){
  83. vm.handlerClickVisitTimeConfirm(context, id: id , cleanServiceType: cleanServiceType);
  84. }),
  85. ),
  86. ],
  87. ),
  88. );
  89. }
  90. }