payment_confirm_page.dart 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:auto_route/auto_route.dart';
  6. import 'package:hooks_riverpod/hooks_riverpod.dart';
  7. import 'package:router/ext/auto_router_extensions.dart';
  8. import 'package:widgets/ext/ex_widget.dart';
  9. import 'package:widgets/my_appbar.dart';
  10. import 'package:widgets/my_button.dart';
  11. import 'package:widgets/my_load_image.dart';
  12. import 'package:widgets/my_text_view.dart';
  13. import 'package:widgets/utils/dark_theme_util.dart';
  14. import '../../router/page/payment_page_router.dart';
  15. import 'payment_confirm_view_model.dart';
  16. @RoutePage()
  17. class PaymentConfirmPage extends HookConsumerWidget {
  18. const PaymentConfirmPage({Key? key}) : super(key: key);
  19. //启动当前页面
  20. static void startInstance({BuildContext? context}) {
  21. if (context != null) {
  22. context.router.push(const PaymentConfirmPageRoute());
  23. } else {
  24. appRouter.push(const PaymentConfirmPageRoute());
  25. }
  26. }
  27. @override
  28. Widget build(BuildContext context, WidgetRef ref) {
  29. final viewModel = ref.watch(paymentConfirmViewModelProvider.notifier);
  30. final state = ref.watch(paymentConfirmViewModelProvider);
  31. return Scaffold(
  32. appBar: MyAppBar.appBar(context, "付款的标题"),
  33. backgroundColor: context.appColors.backgroundWhite,
  34. body: Column(
  35. mainAxisSize: MainAxisSize.max,
  36. crossAxisAlignment: CrossAxisAlignment.start,
  37. children: [
  38. SingleChildScrollView(
  39. scrollDirection: Axis.vertical,
  40. physics: const BouncingScrollPhysics(),
  41. child: Column(
  42. crossAxisAlignment: CrossAxisAlignment.start,
  43. children: [
  44. //金额
  45. Row(
  46. children: [
  47. MyAssetImage(
  48. Assets.paymentInfoDetails,
  49. width: 27,
  50. height: 27,
  51. color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
  52. ),
  53. MyTextView(
  54. S.current.payment_details,
  55. textColor: context.appColors.textBlack,
  56. fontSize: 17,
  57. marginLeft: 14,
  58. isFontMedium: true,
  59. ).expanded(),
  60. ],
  61. ).marginOnly(top: 15, left: 15, right: 15),
  62. Row(
  63. children: [
  64. MyTextView(
  65. "SGD",
  66. textColor: context.appColors.textBlack,
  67. fontSize: 18,
  68. isFontRegular: true,
  69. ),
  70. MyTextView(
  71. "\$21.80",
  72. textColor: context.appColors.textPrimary,
  73. fontSize: 22,
  74. marginLeft: 12,
  75. isFontMedium: true,
  76. ).expanded(),
  77. ],
  78. ).marginOnly(top: 20, left: 15, right: 15),
  79. Container(
  80. height: 0.5,
  81. margin: const EdgeInsets.only(top: 22, bottom: 13.5, left: 15, right: 15),
  82. color: context.appColors.dividerDefault,
  83. ),
  84. // DESC
  85. Row(
  86. children: [
  87. MyAssetImage(
  88. Assets.paymentInfoNotes,
  89. width: 27,
  90. height: 27,
  91. color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
  92. ),
  93. MyTextView(
  94. S.current.notes_to_recipient,
  95. textColor: context.appColors.textBlack,
  96. fontSize: 17,
  97. marginLeft: 14,
  98. isFontMedium: true,
  99. ).expanded(),
  100. ],
  101. ).marginOnly(left: 15, right: 15),
  102. MyTextView(
  103. "The money has already been paid",
  104. textColor: context.appColors.textPrimary,
  105. fontSize: 16,
  106. marginTop: 15,
  107. marginBottom: 20,
  108. marginLeft: 15,
  109. marginRight: 15,
  110. isFontRegular: true,
  111. ),
  112. _paymentInfo(context, ref),
  113. ],
  114. ),
  115. ).expanded(),
  116. // 底部按钮
  117. MyButton(
  118. onPressed: viewModel.doPayment,
  119. text: S.current.proceed_with_payment,
  120. textColor: Colors.white,
  121. backgroundColor: context.appColors.btnBgDefault,
  122. fontWeight: FontWeight.w500,
  123. type: ClickType.throttle,
  124. fontSize: 16,
  125. minHeight: 50,
  126. radius: 0,
  127. ).marginOnly(top: 15),
  128. ],
  129. ),
  130. );
  131. }
  132. //底部的支付信息
  133. Widget _paymentInfo(BuildContext context, WidgetRef ref) {
  134. final viewModel = ref.watch(paymentConfirmViewModelProvider.notifier);
  135. return Container(
  136. height: 75,
  137. padding: const EdgeInsets.symmetric(horizontal: 20),
  138. color: context.appColors.backgroundDark,
  139. child: Row(
  140. children: [
  141. const MyAssetImage(
  142. Assets.paymentMasterCardIcon,
  143. height: 34,
  144. width: 56,
  145. ),
  146. MyTextView(
  147. "Ending 9423",
  148. marginLeft: 15,
  149. marginRight: 15,
  150. textColor: context.appColors.textBlack,
  151. fontSize: 15,
  152. isFontMedium: true,
  153. ).expanded(),
  154. MyTextView(
  155. S.current.change,
  156. textColor: Colors.white,
  157. backgroundColor: context.appColors.btnBgDefault,
  158. paddingRight: 16,
  159. paddingLeft: 16,
  160. paddingTop: 8,
  161. onClick: viewModel.gotoChooseCardPage,
  162. paddingBottom: 8,
  163. cornerRadius: 7,
  164. fontSize: 15,
  165. isFontMedium: true,
  166. )
  167. ],
  168. ));
  169. }
  170. }