discount_view.dart 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import 'dart:async';
  2. import 'package:clean/base/base_page.dart';
  3. import 'package:clean/module/store/discount/discount_controller.dart';
  4. import 'package:clean/utils/expand.dart';
  5. import 'package:flutter/Material.dart';
  6. import 'package:flutter_screenutil/flutter_screenutil.dart';
  7. import 'package:get/get.dart';
  8. import '../../../resource/assets.gen.dart';
  9. import 'count_down_timer.dart';
  10. import 'func_page_view.dart';
  11. class DiscountPage extends BasePage<DiscountController> {
  12. const DiscountPage({super.key});
  13. @override
  14. bool immersive() {
  15. return true;
  16. }
  17. @override
  18. bool statusBarDarkFont() => false;
  19. @override
  20. Widget buildBody(BuildContext context) {
  21. return Obx(() {
  22. bool isFreeItem =
  23. (controller.currentSelectedStoreItem.value?.freeTrialName != null);
  24. bool isShowFree = isFreeItem && controller.isFree.value;
  25. return Scaffold(
  26. backgroundColor: "#05050D".color,
  27. body: Stack(
  28. children: [
  29. SafeArea(
  30. child: Column(
  31. crossAxisAlignment: CrossAxisAlignment.center,
  32. children: [
  33. Row(
  34. children: [
  35. Container(
  36. margin: EdgeInsets.only(left: 16.w, top: 14.h),
  37. child: GestureDetector(
  38. onTap: () {
  39. Get.back();
  40. },
  41. child: Assets.images.iconStoreClose
  42. .image(width: 28.w, height: 28.w),
  43. ),
  44. ),
  45. ],
  46. ),
  47. Assets.images.iconDiscountTitle
  48. .image(width: 259.w, height: 55.h),
  49. SizedBox(
  50. height: 20.h,
  51. ),
  52. Assets.images.iconDiscountPercent
  53. .image(width: 195.w, height: 86.h),
  54. SizedBox(
  55. height: 13.h,
  56. ),
  57. Container(
  58. width: 197.w,
  59. height: 32.h,
  60. padding: EdgeInsets.all(1.w),
  61. decoration: BoxDecoration(
  62. gradient: LinearGradient(
  63. begin: Alignment.topCenter,
  64. end: Alignment.bottomCenter,
  65. colors: [
  66. '#CF9EFD'.color,
  67. '#4DCFFF'.color.withOpacity(0.5),
  68. ],
  69. ),
  70. borderRadius: BorderRadius.all(Radius.circular(18.r)),
  71. ),
  72. child: Container(
  73. decoration: BoxDecoration(
  74. color: "#05050D".color,
  75. borderRadius: BorderRadius.all(Radius.circular(18.r)),
  76. ),
  77. child: Center(
  78. child: Text(
  79. "Get CleanPro Premium",
  80. style: TextStyle(
  81. color: Colors.white,
  82. fontSize: 15.sp,
  83. fontWeight: FontWeight.w700,
  84. ),
  85. ),
  86. ),
  87. ),
  88. ),
  89. SizedBox(
  90. height: 26.h,
  91. ),
  92. // 创建一个1分钟的倒计时
  93. CountdownTimer(duration: const Duration(minutes: 1)),
  94. SizedBox(
  95. height: 40.h,
  96. ),
  97. InfinitePreviewPageView(
  98. height: 98.h,
  99. autoPlay: true,
  100. autoPlayDuration: const Duration(seconds: 5),
  101. items: [
  102. PreviewItem(
  103. title: 'One-click Remove Similar Photos',
  104. icon: Assets.images.iconStoreSimilar.image(),
  105. ),
  106. PreviewItem(
  107. title: 'Detect Blurry and Junk Photos',
  108. icon: Assets.images.iconStoreAi.image(),
  109. ),
  110. PreviewItem(
  111. title: 'Merge Duplicate Contacts',
  112. icon: Assets.images.iconStoreContacts.image(),
  113. ),
  114. PreviewItem(
  115. title: 'Premium Unlimited',
  116. icon: Assets.images.iconStorePremium.image(),
  117. ),
  118. ],
  119. ),
  120. Spacer(),
  121. Text(
  122. isShowFree
  123. ? controller.currentSelectedStoreItem.value
  124. ?.freeTrialName ??
  125. ""
  126. : controller.currentSelectedStoreItem.value?.name ?? "",
  127. style: TextStyle(
  128. color: Colors.white,
  129. fontSize: 16.sp,
  130. fontWeight: FontWeight.w500,
  131. ),
  132. ),
  133. Text(
  134. isShowFree
  135. ? controller.currentSelectedStoreItem.value
  136. ?.freeTrialPriceDesc ??
  137. ""
  138. : controller
  139. .currentSelectedStoreItem.value?.priceDesc ??
  140. "",
  141. style: TextStyle(
  142. color: Colors.white,
  143. fontSize: 13.sp,
  144. ),
  145. ),
  146. SizedBox(
  147. height: 14.h,
  148. ),
  149. GestureDetector(
  150. onTap: () {
  151. controller.onBuyClick();
  152. },
  153. child: Container(
  154. width: 312.w,
  155. height: 48.h,
  156. decoration: BoxDecoration(
  157. color: "#0279FB".color,
  158. borderRadius: BorderRadius.all(
  159. Radius.circular(24.r),
  160. ),
  161. ),
  162. child: Center(
  163. child: Text(
  164. isShowFree
  165. ? "START FREE TRIAL"
  166. : "START NOW",
  167. style: TextStyle(
  168. color: Colors.white,
  169. fontWeight: FontWeight.w700,
  170. fontSize: 16.sp,
  171. ),
  172. ),
  173. ),
  174. ),
  175. ),
  176. SizedBox(
  177. height: 5.h,
  178. ),
  179. Text(
  180. isShowFree
  181. ? "No payment now!"
  182. : "Cancel anytime",
  183. style: TextStyle(
  184. color: isShowFree ? "#57C87A".color : Colors.white,
  185. fontSize: 12.sp,
  186. fontWeight: FontWeight.w500,
  187. ),
  188. ),
  189. ],
  190. ),
  191. ),
  192. ],
  193. ),
  194. );
  195. });
  196. }
  197. }