chooseVisitTimeBottomFooter.dart 3.4 KB

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