rewards_code_page.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. const RewardsCodePage({Key? key}) : super(key: key);
  20. //启动当前页面
  21. static void startInstance({BuildContext? context}) {
  22. if (context != null) {
  23. context.router.push(const RewardsCodePageRoute());
  24. } else {
  25. appRouter.push(const RewardsCodePageRoute());
  26. }
  27. }
  28. Widget _buildItemLeftSection(BuildContext context, WidgetRef ref, item, _vm) {
  29. return Column(
  30. children: [
  31. Column(
  32. crossAxisAlignment: CrossAxisAlignment.center,
  33. mainAxisAlignment: MainAxisAlignment.center,
  34. children: [
  35. const Center(
  36. child: Text(
  37. 'SHOW THE VERIFICATION CODE TO YOUR MERCHANT',
  38. textAlign: TextAlign.center,
  39. style: TextStyle(
  40. fontSize: 20.0,
  41. color: Colors.black,
  42. fontWeight: FontWeight.w500),
  43. ),
  44. ),
  45. Text(
  46. 'VERIFICATION CODE',
  47. style: TextStyle(
  48. fontSize: 18.0,
  49. color: ColorUtils.string2Color('#54638C'),
  50. fontWeight: FontWeight.w500),
  51. ).marginOnly(top: 35, bottom: 20),
  52. Text(
  53. '778890',
  54. style: TextStyle(
  55. fontSize: 36.0,
  56. color: ColorUtils.string2Color('#4161D0'),
  57. fontWeight: FontWeight.w500),
  58. ),
  59. ],
  60. ),
  61. ],
  62. );
  63. }
  64. // listitem
  65. Widget _buildSaleItem(BuildContext context, WidgetRef ref, item, _vm) {
  66. return Column(
  67. children: [
  68. Container(
  69. decoration: const BoxDecoration(
  70. color: Colors.white,
  71. borderRadius: BorderRadius.all(Radius.circular(6.0)),
  72. boxShadow: [
  73. BoxShadow(
  74. color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
  75. ],
  76. ),
  77. width: MediaQuery.of(context).size.width - 30,
  78. height: 250,
  79. // margin: const EdgeInsets.only(left: 15, right: 15, top: 12.5),
  80. child: Column(
  81. crossAxisAlignment: CrossAxisAlignment.start,
  82. mainAxisAlignment: MainAxisAlignment.start,
  83. children: [_buildItemLeftSection(context, ref, item, _vm)],
  84. ).paddingOnly(left: 26, right: 26, top: 40),
  85. ),
  86. ],
  87. ).marginOnly(left: 15, bottom: 15, right: 15);
  88. }
  89. // list
  90. Widget _buildSaleList(BuildContext context, WidgetRef ref, _vm) {
  91. List itemsList = _vm.state.list.toList();
  92. return _buildSaleItem(context, ref, itemsList[0], _vm);
  93. }
  94. @override
  95. Widget build(BuildContext context, WidgetRef ref) {
  96. final _vm = ref.read(rewardsCodeVmProvider.notifier);
  97. final state = ref.watch(rewardsCodeVmProvider);
  98. return Scaffold(
  99. appBar: MyAppBar.appBar(
  100. context,
  101. "Verification Code",
  102. backgroundColor: context.appColors.whiteBG,
  103. ),
  104. body: Container(
  105. child: Column(
  106. children: [
  107. Expanded(
  108. child:
  109. EasyRefresh(
  110. child:
  111. Container(
  112. color: ColorUtils.string2Color('#F2F3F6'),
  113. padding: const EdgeInsets.only(top: 15),
  114. child: _buildSaleList(context, ref, _vm)),
  115. ),
  116. )
  117. ],
  118. ),
  119. ),
  120. );
  121. }
  122. }