123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- import 'package:cpt_rewards/modules/rewards_address/rewards_address_page.dart';
- import 'package:cpt_rewards/modules/rewards_my/rewards_my_page.dart';
- import 'package:cs_resources/theme/app_colors_theme.dart';
- import 'package:domain/entity/rewards_buy_entity.dart';
- import 'package:domain/entity/rewards_detail_entity.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:auto_route/auto_route.dart';
- import 'package:hooks_riverpod/hooks_riverpod.dart';
- import 'package:router/ext/auto_router_extensions.dart';
- import 'package:shared/utils/log_utils.dart';
- import 'package:shared/utils/color_utils.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_appbar.dart';
- import 'package:widgets/my_load_image.dart';
- import 'package:widgets/my_text_view.dart';
- import 'package:widgets/shatter/picker_container.dart';
- import 'package:widgets/widget_export.dart';
- import 'package:cs_resources/generated/assets.dart';
- import '../../../router/page/rewards_page_router.dart';
- import './rewards_successful_vm.dart';
- @RoutePage()
- class RewardsSuccessfulPage extends HookConsumerWidget {
- final int? amount;
- final String? title;
- final String? resources;
- final String? redeemedDate;
- final String? createdAt;
- const RewardsSuccessfulPage(
- {Key? key,
- @PathParam('amount') required this.amount,
- @PathParam('title') required this.title,
- @PathParam('resources') required this.resources,
- @PathParam('redeemedDate') required this.redeemedDate,
- @PathParam('createdAt') required this.createdAt})
- : super(key: key);
- //启动当前页面
- static void startInstance({
- BuildContext? context,
- int? amount,
- String? title = '',
- String? resources = '',
- String? redeemedDate = '',
- String? createdAt = '',
- }) {
- if (context != null) {
- context.router.push(RewardsSuccessfulPageRoute(
- amount: amount,
- title: title,
- resources: resources,
- redeemedDate: redeemedDate,
- createdAt: createdAt));
- } else {
- appRouter.push(RewardsSuccessfulPageRoute(
- amount: amount,
- title: title,
- resources: resources,
- redeemedDate: redeemedDate,
- createdAt: createdAt));
- }
- }
- // listitem
- Widget _buildSaleItem(BuildContext context, WidgetRef ref, _vm) {
- String? titles = title ?? '';
- String? resourcess = resources ?? '';
- return Column(
- children: [
- Container(
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
- boxShadow: [
- BoxShadow(
- color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
- ],
- ),
- width: MediaQuery.of(context).size.width - 30,
- // height: 420,
- // margin: const EdgeInsets.only(left: 15, right: 15, top: 12.5),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- MyLoadImage(
- resourcess,
- width: MediaQuery.of(context).size.width,
- height: 150,
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Text(
- maxLines: 1, // 设置最大行数为2
- overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
- titles,
- style: const TextStyle(
- fontSize: 17.0,
- color: Colors.black,
- fontWeight: FontWeight.w500),
- ),
- ],
- ).paddingOnly(left: 15, right: 15, top: 10, bottom: 30),
- ],
- )),
- ],
- ).marginOnly(left: 15, bottom: 15, right: 15);
- }
- Widget _buildDeal(BuildContext context, WidgetRef ref, _vm) {
- return Column(
- children: [
- Container(
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
- boxShadow: [
- BoxShadow(
- color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
- ],
- ),
- width: MediaQuery.of(context).size.width - 30,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const MyAssetImage(
- Assets.rewardsRewardsDetailDeal,
- width: 25,
- height: 25,
- ).marginOnly(right: 5),
- Text(
- 'Redeem Deal At',
- style: TextStyle(
- fontSize: 15.0,
- color: ColorUtils.string2Color('#000000'),
- fontWeight: FontWeight.w500),
- )
- ],
- ),
- Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- '60 paya lebar rd, #09-13/17 paya lebar square, singapore 409051',
- maxLines: 2, // 设置最大行数为2
- overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
- style: TextStyle(
- fontSize: 15.0,
- color: ColorUtils.string2Color('#54638C'),
- fontWeight: FontWeight.w400),
- ),
- ],
- ),
- ],
- ).paddingOnly(left: 15, right: 15, top: 12, bottom: 20),
- ),
- ],
- ).marginOnly(left: 15, bottom: 15, right: 15);
- }
- Widget _buildPackage(BuildContext context, WidgetRef ref, _vm) {
- String? redeemedDates = redeemedDate ?? '';
- return Column(
- children: [
- Container(
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
- boxShadow: [
- BoxShadow(
- color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
- ],
- ),
- width: MediaQuery.of(context).size.width - 30,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const MyAssetImage(
- Assets.rewardsRewardsIconDatd,
- width: 15,
- height: 15,
- ).marginOnly(right: 10),
- Text(
- 'Redeem From',
- style: TextStyle(
- fontSize: 15.0,
- color: ColorUtils.string2Color('#000000'),
- fontWeight: FontWeight.w500),
- )
- ],
- ).marginOnly(bottom: 10),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- redeemedDates,
- style: TextStyle(
- fontSize: 15.0,
- color: ColorUtils.string2Color('#54638C'),
- fontWeight: FontWeight.w400),
- ),
- ],
- ),
- ],
- ).paddingOnly(left: 15, right: 15, top: 12, bottom: 20),
- ),
- ],
- ).marginOnly(left: 15, bottom: 15, right: 15);
- }
- Widget _buildNotice(BuildContext context, WidgetRef ref, _vm) {
- String? createdAts = createdAt ?? '';
- return Column(
- children: [
- Container(
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
- boxShadow: [
- BoxShadow(
- color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)
- ],
- ),
- width: MediaQuery.of(context).size.width - 30,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- 'Date & Time:',
- style: TextStyle(
- fontSize: 15.0,
- color: ColorUtils.string2Color('#333333'),
- fontWeight: FontWeight.w400),
- ),
- Row(
- children: [
- Text(
- createdAts,
- style: TextStyle(
- fontSize: 15.0,
- color: ColorUtils.string2Color('#54638C'),
- fontWeight: FontWeight.w400),
- ),
- ],
- ),
- ],
- ),
- // Row(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // crossAxisAlignment: CrossAxisAlignment.center,
- // children: [
- // Text(
- // 'Transaction ID:',
- // style: TextStyle(
- // fontSize: 15.0,
- // color: ColorUtils.string2Color('#333333'),
- // fontWeight: FontWeight.w400),
- // ),
- // Row(
- // children: [
- // Text(
- // 'PR00021837HY',
- // style: TextStyle(
- // fontSize: 15.0,
- // color: ColorUtils.string2Color('#54638C'),
- // fontWeight: FontWeight.w400),
- // ),
- // ],
- // ),
- // ],
- // ).marginOnly(top: 30, bottom: 10),
- ],
- ).paddingOnly(left: 15, right: 15, top: 30, bottom: 30),
- ),
- ],
- ).marginOnly(left: 15, bottom: 15, right: 15);
- }
- Widget _buildTop(BuildContext context, WidgetRef ref, _vm) {
- return Container(
- width: MediaQuery.of(context).size.width,
- color: ColorUtils.string2Color('#FFFFFF'),
- padding: const EdgeInsets.only(top: 15, bottom: 30),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const MyAssetImage(
- Assets.rewardsRewardsSuccess,
- width: 54,
- height: 54,
- ),
- Text(
- 'You Have Paid Points',
- style: TextStyle(
- fontSize: 18.0,
- color: ColorUtils.string2Color('#4161D0'),
- fontWeight: FontWeight.w500),
- ).marginOnly(top: 12, bottom: 15),
- Text(
- '600',
- style: TextStyle(
- fontSize: 30.0,
- color: ColorUtils.string2Color('#000000'),
- fontWeight: FontWeight.w500),
- ),
- ],
- ));
- }
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final _vm = ref.read(rewardsSuccessfulVmProvider.notifier);
- final state = ref.watch(rewardsSuccessfulVmProvider);
- // RewardsBuyEntity? datad = data;
- return Scaffold(
- appBar: MyAppBar.appBar(
- context,
- "Payment Successful",
- backgroundColor: context.appColors.whiteBG,
- ),
- body: Column(
- children: [
- Expanded(
- child: SingleChildScrollView(
- scrollDirection: Axis.vertical,
- physics: const BouncingScrollPhysics(),
- clipBehavior: Clip.none,
- child: Column(
- children: [
- _buildTop(context, ref, _vm),
- Container(
- color: ColorUtils.string2Color('#F2F3F6'),
- padding: const EdgeInsets.only(top: 15),
- child: Column(
- children: [
- _buildSaleItem(context, ref, _vm),
- _buildDeal(context, ref, _vm),
- _buildPackage(context, ref, _vm),
- _buildNotice(context, ref, _vm),
- ],
- )),
- ],
- ))),
- Container(
- height: 50,
- color: ColorUtils.string2Color('#4161D0'),
- child: Flex(
- direction: Axis.horizontal,
- children: [
- Expanded(
- flex: 1,
- child: Container(
- color: ColorUtils.string2Color('#4161D0'),
- height: 100,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "Check My Rewards",
- fontSize: 16,
- textColor: Colors.white,
- isFontMedium: true,
- ),
- ],
- ),
- ).onTap(() {
- // 去详情
- RewardsMyPage.startInstance();
- }),
- ),
- ],
- ),
- )
- ],
- ),
- );
- }
- }
|