chooseVisitTimeBottomFooter.dart 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. num cleanServiceToast = ref.watch(serviceOrderConfirmVmProvider.select((state) => state.cleanServiceToTalCost??0.0));
  24. num extraPrice = ref.watch(chooseVisitTimeContentVmProvider.select((state) => state.extraTotalCost??0.0));
  25. num totalPrice = cleanServiceToast + extraPrice;
  26. useEffect((){
  27. // 组件挂载时执行 - 执行接口请求
  28. // Future.microtask(() => vm.initPageData());
  29. return () {
  30. // 组件卸载时执行
  31. };
  32. },[]);
  33. return Container(
  34. height: 50,
  35. width: double.infinity,
  36. child: Row(
  37. mainAxisAlignment: MainAxisAlignment.center,
  38. mainAxisSize: MainAxisSize.max,
  39. children: [
  40. Container(
  41. constraints: const BoxConstraints(
  42. minWidth: 122,
  43. ),
  44. child: Row(
  45. mainAxisAlignment: MainAxisAlignment.center,
  46. crossAxisAlignment: CrossAxisAlignment.center,
  47. mainAxisSize: MainAxisSize.max,
  48. children: [
  49. Container(
  50. alignment: Alignment.center,
  51. padding: const EdgeInsets.only(left:5, right: 0,top:5,bottom: 5),
  52. child: Row(
  53. mainAxisAlignment: MainAxisAlignment.center,
  54. mainAxisSize: MainAxisSize.max,
  55. children: [
  56. MyTextView(
  57. "\$$totalPrice",
  58. fontSize: 18,
  59. textColor: Colors.white,
  60. isFontRegular: true,
  61. maxLines:2,
  62. isTextEllipsis: true,
  63. marginLeft: 5,
  64. marginRight: 15,
  65. ),
  66. ],
  67. ),
  68. ),
  69. ],
  70. ).backgroundColor(context.appColors.textPrimary),
  71. ),
  72. Expanded(
  73. child: Container(
  74. color: context.appColors.redDefault,
  75. child: Center(
  76. child: MyTextView(
  77. 'Confirm',
  78. textColor: context.appColors.textWhite,
  79. fontSize: 17,
  80. isFontMedium: true,
  81. textAlign: TextAlign.center,
  82. ),
  83. ),
  84. ).onTap((){
  85. vm.handlerClickVisitTimeConfirm(context, id: id , cleanServiceType: cleanServiceType);
  86. }),
  87. ),
  88. ],
  89. ),
  90. );
  91. }
  92. }