|
|
@@ -1,5 +1,3 @@
|
|
|
-import 'dart:async';
|
|
|
-
|
|
|
import 'package:clean/base/base_page.dart';
|
|
|
import 'package:clean/data/bean/store_item.dart';
|
|
|
import 'package:clean/data/consts/constants.dart';
|
|
|
@@ -37,64 +35,68 @@ class DiscountPage extends BasePage<DiscountController> {
|
|
|
StoreItem? freeItem = controller.storeItems
|
|
|
.firstWhereOrNull((element) => element.freeTrialName != null) ??
|
|
|
controller.storeItems.firstOrNull;
|
|
|
- return Scaffold(
|
|
|
- backgroundColor: "#05050D".color,
|
|
|
- body: Stack(
|
|
|
- children: [
|
|
|
- SafeArea(
|
|
|
- child: SingleChildScrollView(
|
|
|
+ return PopScope(
|
|
|
+ canPop: controller.isShowBackButton.value,
|
|
|
+ child: Scaffold(
|
|
|
+ backgroundColor: "#05050D".color,
|
|
|
+ body: Stack(
|
|
|
+ children: [
|
|
|
+ SafeArea(
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ _AppBar(controller: controller),
|
|
|
+ _DiscountHeader(),
|
|
|
+ SizedBox(height: 26.h),
|
|
|
+ // 创建一个1分钟的倒计时
|
|
|
+ CountdownTimer(duration: const Duration(minutes: 1)),
|
|
|
+ SizedBox(height: 40.h),
|
|
|
+ if (freeItem != null)
|
|
|
+ _DiscountFreeTrialSpecialRow(
|
|
|
+ item: freeItem,
|
|
|
+ canUseFreeTrailPlan: canUseFreeTrailPlan,
|
|
|
+ isSelected:
|
|
|
+ controller.currentSelectedStoreItem.value?.id ==
|
|
|
+ freeItem.id,
|
|
|
+ onSelect: (title) {
|
|
|
+ controller.currentSelectedStoreItem.value =
|
|
|
+ freeItem;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ SizedBox(height: 40.h),
|
|
|
+ _FeaturesPreview(),
|
|
|
+ SizedBox(height: 40.h),
|
|
|
+ _MorePlansSection(),
|
|
|
+ SizedBox(height: 5.h),
|
|
|
+ _OtherPlansSection(
|
|
|
+ items: controller.storeItems
|
|
|
+ .where((element) => element.id != freeItem?.id)
|
|
|
+ .toList(),
|
|
|
+ controller: controller),
|
|
|
+ SizedBox(height: 100.h),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SafeArea(
|
|
|
+ top: false,
|
|
|
child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
children: [
|
|
|
- _AppBar(),
|
|
|
- _DiscountHeader(),
|
|
|
- SizedBox(height: 26.h),
|
|
|
- // 创建一个1分钟的倒计时
|
|
|
- CountdownTimer(duration: const Duration(minutes: 1)),
|
|
|
- SizedBox(height: 40.h),
|
|
|
- if (freeItem != null)
|
|
|
- _DiscountFreeTrialSpecialRow(
|
|
|
- item: freeItem,
|
|
|
- canUseFreeTrailPlan: canUseFreeTrailPlan,
|
|
|
- isSelected:
|
|
|
- controller.currentSelectedStoreItem.value?.id ==
|
|
|
- freeItem.id,
|
|
|
- onSelect: (title) {
|
|
|
- controller.currentSelectedStoreItem.value = freeItem;
|
|
|
- },
|
|
|
+ Spacer(),
|
|
|
+ SizedBox(
|
|
|
+ width: double.infinity,
|
|
|
+ child: _PurchaseSection(
|
|
|
+ isSelectFreeItem: isSelectFreeItem,
|
|
|
+ controller: controller,
|
|
|
),
|
|
|
- SizedBox(height: 40.h),
|
|
|
- _FeaturesPreview(),
|
|
|
- SizedBox(height: 40.h),
|
|
|
- _MorePlansSection(),
|
|
|
- SizedBox(height: 5.h),
|
|
|
- _OtherPlansSection(
|
|
|
- items: controller.storeItems
|
|
|
- .where((element) => element.id != freeItem?.id)
|
|
|
- .toList(),
|
|
|
- controller: controller),
|
|
|
- SizedBox(height: 100.h),
|
|
|
+ )
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- SafeArea(
|
|
|
- top: false,
|
|
|
- child: Column(
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- children: [
|
|
|
- Spacer(),
|
|
|
- SizedBox(
|
|
|
- width: double.infinity,
|
|
|
- child: _PurchaseSection(
|
|
|
- isSelectFreeItem: isSelectFreeItem,
|
|
|
- controller: controller,
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
});
|
|
|
@@ -102,7 +104,9 @@ class DiscountPage extends BasePage<DiscountController> {
|
|
|
}
|
|
|
|
|
|
class _AppBar extends StatelessWidget {
|
|
|
- const _AppBar({Key? key}) : super(key: key);
|
|
|
+ final DiscountController controller;
|
|
|
+
|
|
|
+ const _AppBar({required this.controller});
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|