payment_info_page.dart 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import 'package:cpt_payment/modules/payment/condo/active/condo_active_screen.dart';
  2. import 'package:cs_resources/generated/assets.dart';
  3. import 'package:cs_resources/generated/l10n.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:router/ext/auto_router_extensions.dart';
  10. import 'package:widgets/ext/ex_widget.dart';
  11. import 'package:widgets/my_appbar.dart';
  12. import 'package:widgets/my_button.dart';
  13. import 'package:widgets/my_load_image.dart';
  14. import 'package:widgets/my_text_view.dart';
  15. import 'package:widgets/widget_export.dart';
  16. import '../../router/page/payment_page_router.dart';
  17. import 'payment_info_view_model.dart';
  18. @RoutePage()
  19. class PaymentInfoPage extends HookConsumerWidget {
  20. const PaymentInfoPage({Key? key}) : super(key: key);
  21. //启动当前页面
  22. static void startInstance({BuildContext? context}) {
  23. if (context != null) {
  24. context.router.push(const PaymentInfoPageRoute());
  25. } else {
  26. appRouter.push(const PaymentInfoPageRoute());
  27. }
  28. }
  29. @override
  30. Widget build(BuildContext context, WidgetRef ref) {
  31. final viewModel = ref.watch(paymentInfoViewModelProvider.notifier);
  32. final state = ref.watch(paymentInfoViewModelProvider);
  33. final noteCount = useState(0);
  34. return Scaffold(
  35. appBar: MyAppBar.appBar(context, "付款的标题"),
  36. backgroundColor: context.appColors.whiteBG,
  37. body: Column(
  38. mainAxisSize: MainAxisSize.max,
  39. crossAxisAlignment: CrossAxisAlignment.start,
  40. children: [
  41. SingleChildScrollView(
  42. scrollDirection: Axis.vertical,
  43. physics: const BouncingScrollPhysics(),
  44. child: Column(
  45. crossAxisAlignment: CrossAxisAlignment.start,
  46. children: [
  47. //金额
  48. Row(
  49. children: [
  50. const MyAssetImage(Assets.paymentInfoDetails, width: 27, height: 27),
  51. MyTextView(
  52. S.current.payment_details,
  53. textColor: context.appColors.textBlack,
  54. fontSize: 17,
  55. marginLeft: 14,
  56. isFontMedium: true,
  57. ).expanded(),
  58. ],
  59. ).marginOnly(top: 15),
  60. Row(
  61. children: [
  62. MyTextView(
  63. "SGD",
  64. textColor: context.appColors.textBlack,
  65. fontSize: 18,
  66. isFontRegular: true,
  67. ),
  68. MyTextView(
  69. "\$21.80",
  70. textColor: context.appColors.textPrimary,
  71. fontSize: 22,
  72. marginLeft: 12,
  73. isFontMedium: true,
  74. ).expanded(),
  75. ],
  76. ).marginOnly(top: 20),
  77. Container(
  78. height: 0.5,
  79. margin: const EdgeInsets.only(top: 22,bottom: 13.5),
  80. color: context.appColors.dividerDefault,
  81. ),
  82. // DESC
  83. Row(
  84. children: [
  85. const MyAssetImage(Assets.paymentInfoNotes, width: 27, height: 27),
  86. MyTextView(
  87. S.current.notes_to_recipient,
  88. textColor: context.appColors.textBlack,
  89. fontSize: 17,
  90. marginLeft: 14,
  91. isFontMedium: true,
  92. ).expanded(),
  93. ],
  94. ),
  95. //大文本框
  96. IgnoreKeyboardDismiss(
  97. child: Container(
  98. height: 177,
  99. margin: const EdgeInsets.only(top: 24),
  100. padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
  101. decoration: BoxDecoration(
  102. color: context.appColors.authFiledBG,
  103. borderRadius: const BorderRadius.all(Radius.circular(5)),
  104. ),
  105. child: Stack(
  106. children: [
  107. TextField(
  108. cursorColor: context.appColors.authFiledText,
  109. cursorWidth: 1.5,
  110. autofocus: false,
  111. enabled: true,
  112. focusNode: state.formData["note"]!['focusNode'],
  113. controller: state.formData["note"]!['controller'],
  114. decoration: InputDecoration(
  115. isDense: true,
  116. isCollapsed: true,
  117. border: InputBorder.none,
  118. hintText: state.formData["note"]!['hintText'],
  119. hintStyle: TextStyle(
  120. color: context.appColors.authFiledHint,
  121. fontSize: 16.0,
  122. fontWeight: FontWeight.w500,
  123. ),
  124. ),
  125. style: TextStyle(
  126. color: context.appColors.authFiledText,
  127. fontSize: 16.0,
  128. fontWeight: FontWeight.w500,
  129. ),
  130. textInputAction: TextInputAction.done,
  131. onSubmitted: (value) {
  132. FocusScope.of(context).unfocus();
  133. },
  134. maxLines: null,
  135. expands: true,
  136. onChanged: (text) {
  137. // 当文本改变时,更新字符数量
  138. noteCount.value = text.length;
  139. },
  140. ),
  141. Positioned(
  142. bottom: 0.0,
  143. right: 0.0,
  144. child: Text(
  145. S.current.characters(noteCount.value),
  146. style: TextStyle(
  147. color: context.appColors.textBlack,
  148. fontSize: 15.0,
  149. ),
  150. ),
  151. ),
  152. ],
  153. ),
  154. ),
  155. ),
  156. ],
  157. ).paddingSymmetric(horizontal: 15))
  158. .expanded(),
  159. // 底部按钮
  160. MyButton(
  161. onPressed: viewModel.gotoConfirmPage,
  162. text: S.current.next,
  163. textColor: Colors.white,
  164. backgroundColor: context.appColors.btnBgDefault,
  165. fontWeight: FontWeight.w500,
  166. type: ClickType.throttle,
  167. fontSize: 16,
  168. minHeight: 50,
  169. radius: 0,
  170. ).marginOnly(top: 15),
  171. ],
  172. ),
  173. );
  174. }
  175. }