rewards_code_page.dart 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import 'package:cs_resources/theme/app_colors_theme.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:auto_route/auto_route.dart';
  5. import 'package:hooks_riverpod/hooks_riverpod.dart';
  6. import 'package:router/ext/auto_router_extensions.dart';
  7. import 'package:shared/utils/log_utils.dart';
  8. import 'package:shared/utils/color_utils.dart';
  9. import 'package:widgets/ext/ex_widget.dart';
  10. import 'package:widgets/my_appbar.dart';
  11. import 'package:widgets/my_load_image.dart';
  12. import 'package:widgets/shatter/picker_container.dart';
  13. import 'package:widgets/widget_export.dart';
  14. import 'package:cs_resources/generated/assets.dart';
  15. import '../../../router/page/rewards_page_router.dart';
  16. import './rewards_code_vm.dart';
  17. @RoutePage()
  18. class RewardsCodePage extends HookConsumerWidget {
  19. final int? code;
  20. const RewardsCodePage({Key? key, @PathParam('code') required this.code}) : super(key: key);
  21. //启动当前页面
  22. static void startInstance({BuildContext? context,
  23. int? code,
  24. }) {
  25. if (context != null) {
  26. context.router.push(RewardsCodePageRoute(code: code));
  27. } else {
  28. appRouter.push(RewardsCodePageRoute(code: code));
  29. }
  30. }
  31. Widget _buildItemLeftSection(BuildContext context, WidgetRef ref, item, _vm) {
  32. int? codes = code ?? 0;
  33. return Column(
  34. children: [
  35. Column(
  36. crossAxisAlignment: CrossAxisAlignment.center,
  37. mainAxisAlignment: MainAxisAlignment.center,
  38. children: [
  39. const Center(
  40. child: Text(
  41. 'SHOW THE VERIFICATION CODE TO YOUR MERCHANT',
  42. textAlign: TextAlign.center,
  43. style: TextStyle(
  44. fontSize: 20.0,
  45. color: Colors.black,
  46. fontWeight: FontWeight.w500),
  47. ),
  48. ),
  49. Text(
  50. 'VERIFICATION CODE',
  51. style: TextStyle(
  52. fontSize: 18.0,
  53. color: ColorUtils.string2Color('#54638C'),
  54. fontWeight: FontWeight.w500),
  55. ).marginOnly(top: 35, bottom: 20),
  56. Text(
  57. '$codes',
  58. style: TextStyle(
  59. fontSize: 36.0,
  60. color: ColorUtils.string2Color('#4161D0'),
  61. fontWeight: FontWeight.w500),
  62. ),
  63. ],
  64. ),
  65. ],
  66. );
  67. }
  68. // listitem
  69. Widget _buildSaleItem(BuildContext context, WidgetRef ref, item, _vm) {
  70. return Column(
  71. children: [
  72. Container(
  73. decoration: const BoxDecoration(
  74. color: Colors.white,
  75. borderRadius: BorderRadius.all(Radius.circular(6.0)),
  76. boxShadow: [
  77. BoxShadow(
  78. color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
  79. ],
  80. ),
  81. width: MediaQuery.of(context).size.width - 30,
  82. height: 250,
  83. // margin: const EdgeInsets.only(left: 15, right: 15, top: 12.5),
  84. child: Column(
  85. crossAxisAlignment: CrossAxisAlignment.start,
  86. mainAxisAlignment: MainAxisAlignment.start,
  87. children: [_buildItemLeftSection(context, ref, item, _vm)],
  88. ).paddingOnly(left: 26, right: 26, top: 40),
  89. ),
  90. ],
  91. ).marginOnly(left: 15, bottom: 15, right: 15);
  92. }
  93. // list
  94. Widget _buildSaleList(BuildContext context, WidgetRef ref, _vm) {
  95. List itemsList = _vm.state.list.toList();
  96. return _buildSaleItem(context, ref, itemsList[0], _vm);
  97. }
  98. @override
  99. Widget build(BuildContext context, WidgetRef ref) {
  100. final _vm = ref.read(rewardsCodeVmProvider.notifier);
  101. final state = ref.watch(rewardsCodeVmProvider);
  102. return Scaffold(
  103. appBar: MyAppBar.appBar(
  104. context,
  105. "Verification Code",
  106. backgroundColor: context.appColors.whiteBG,
  107. ),
  108. body: Container(
  109. child: Column(
  110. children: [
  111. Expanded(
  112. child:
  113. EasyRefresh(
  114. child:
  115. Container(
  116. color: ColorUtils.string2Color('#F2F3F6'),
  117. padding: const EdgeInsets.only(top: 15),
  118. child: _buildSaleList(context, ref, _vm)),
  119. ),
  120. )
  121. ],
  122. ),
  123. ),
  124. );
  125. }
  126. }