Browse Source

[feat]商店页,iOS平台的UI调整

hezihao 7 months ago
parent
commit
c3fec14dda
2 changed files with 105 additions and 60 deletions
  1. 103 58
      lib/module/store/store_page.dart
  2. 2 2
      lib/widget/platform_util.dart

+ 103 - 58
lib/module/store/store_page.dart

@@ -9,6 +9,7 @@ import 'package:keyboard/data/consts/web_url.dart';
 import 'package:keyboard/module/store/store_controller.dart';
 import 'package:keyboard/module/store/store_user_reviews_bean.dart';
 import 'package:keyboard/resource/string.gen.dart';
+import 'package:keyboard/widget/platform_util.dart';
 
 import '../../data/consts/constants.dart';
 import '../../resource/assets.gen.dart';
@@ -36,30 +37,49 @@ class StorePage extends BasePage<StoreController> {
 
   @override
   Widget buildBody(BuildContext context) {
-    return PopScope(
-      canPop: false,
-      onPopInvokedWithResult: (didPop, result) {
-        if (didPop) {
-          return;
-        }
-        controller.clickBack();
-      },
-      child: Stack(
+    Widget bottomArea;
+    if (PlatformUtil.isIOS) {
+      bottomArea = Column(
         children: [
-          SingleChildScrollView(
-            child: Column(
-              children: [
-                _buildBanner(context),
-                SizedBox(height: 12.h),
-                _buildGoodsCard(),
-                _buildVipDesc(),
-                SizedBox(height: 32.h),
-                _buildUserReviews(),
-                SizedBox(height: 20.h),
-                _buildUserNotice(),
-              ],
+          // iOS平台的隐私协议和服务条款
+          _buildLastBottomCorner(
+            child: Container(
+              margin: EdgeInsets.only(left: 16.w),
+              child: _buildPrivacy(
+                privacyColor: Color(0x99673300),
+                mainAxisAlignment: MainAxisAlignment.start,
+              ),
             ),
           ),
+          // 恢复订阅入口
+          _buildRecoverSubscribe(),
+          SizedBox(height: 50.h),
+        ],
+      );
+    } else {
+      // 安卓端,可以有会员心声和购买须知
+      bottomArea = Column(
+        children: [
+          // 产品描述
+          _buildLastBottomCorner(child: _buildVipDesc()),
+          SizedBox(height: 32.h),
+          _buildUserReviews(),
+          SizedBox(height: 20.h),
+          _buildUserNotice(),
+        ],
+      );
+    }
+    return Stack(
+      children: [
+        SingleChildScrollView(
+          child: Column(
+            children: [
+              _buildBanner(context),
+              SizedBox(height: 12.h),
+              _buildGoodsCard(),
+              bottomArea,
+            ],
+          ),
           Positioned(top: 0, left: 0, right: 0, child: _buildTitle()),
           Positioned(
             bottom: 0,
@@ -237,7 +257,10 @@ class StorePage extends BasePage<StoreController> {
               }).toList(),
             );
           }),
-          _buildPayWayCard(),
+          // iOS平台的产品描述
+          if (PlatformUtil.isIOS) _buildVipDesc(),
+          // 非iOS平台,才有支付宝支付和微信支付
+          if (!PlatformUtil.isIOS) _buildPayWayCard(),
         ],
       ),
     );
@@ -473,7 +496,8 @@ class StorePage extends BasePage<StoreController> {
     );
   }
 
-  Widget _buildVipDesc() {
+  /// 最后的底部圆角
+  Widget _buildLastBottomCorner({required Widget child}) {
     return Container(
       alignment: Alignment.centerLeft,
       margin: EdgeInsets.symmetric(horizontal: 16.w),
@@ -502,35 +526,20 @@ class StorePage extends BasePage<StoreController> {
       ),
       child: Column(
 
-        crossAxisAlignment: CrossAxisAlignment.start,
-        children: [
-          Obx(() {
-            return Text(
-              controller.selectedGoodsInfoItem?.selectDesc ?? "",
-              style: Styles.getTextStyle99673300W400(12.sp),
-            );
-          }),
-          Visibility(visible:!isNotHWChannel(),child:       Container(
-            alignment: Alignment.centerLeft,
-            child: GestureDetector(
-              onTap: () {
-                BrowserPage.start(WebUrl.memberServiceAgreement);
-              },
-              child:Text(
-                StringName.textSpanMembershipAgreement,
-                style: TextStyle(
-                  color: const Color(0xFF459FFF),
-                  fontSize: 10.sp,
-                  fontWeight: FontWeight.w400,
-                ),
-              ),),
-          ), )
-
-        ],
-      ),
+      child: child,
     );
   }
 
+  /// 产品描述
+  Widget _buildVipDesc() {
+    return Obx(() {
+      return Text(
+        controller.selectedGoodsInfoItem?.selectDesc ?? "",
+        style: Styles.getTextStyle99673300W400(12.sp),
+      );
+    });
+  }
+
   // 轮播图
   Widget _buildBanner(BuildContext context) {
     return SizedBox(
@@ -795,6 +804,38 @@ class StorePage extends BasePage<StoreController> {
     );
   }
 
+  /// 恢复订阅
+  Widget _buildRecoverSubscribe() {
+    return Container(
+      margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
+      child: Row(
+        children: [
+          Text(
+            "⚠️  订阅未生效?点此试试",
+            style: TextStyle(
+              color: Color(0xFF666355),
+              fontSize: 13.sp,
+              fontWeight: FontWeight.w400,
+            ),
+          ),
+          GestureDetector(
+            onTap: () {
+              // 恢复订阅
+            },
+            child: Text(
+              "  恢复订阅>",
+              style: TextStyle(
+                color: Color(0xFF479DF7),
+                fontSize: 13.sp,
+                fontWeight: FontWeight.w400,
+              ),
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+
   Widget _buildBuyButtonCard() {
     return Container(
       width: 360.w,
@@ -858,15 +899,20 @@ class StorePage extends BasePage<StoreController> {
             ),
           ),
 
-          _buildPrivacy(),
+          // 安卓平台的隐私协议和服务条款
+          if (!PlatformUtil.isIOS) _buildPrivacy(),
         ],
       ),
     );
   }
 
-  Widget _buildPrivacy() {
+  /// 隐私协议和服务条款
+  Widget _buildPrivacy({
+    Color privacyColor = const Color(0xFF459FFF),
+    MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
+  }) {
     return Row(
-      mainAxisAlignment: MainAxisAlignment.center,
+      mainAxisAlignment: mainAxisAlignment,
       children: [
         Obx(() {
           return GestureDetector(
@@ -917,12 +963,9 @@ class StorePage extends BasePage<StoreController> {
                 ClickTextSpan(
                   text: StringName.textSpanPrivacyPolicy,
                   url: WebUrl.privacyPolicy,
+                  color: privacyColor,
                 ),
 
-                ClickTextSpan(
-                  text: StringName.textSpanServiceTerms,
-                  url: WebUrl.serviceAgreement,
-                ),
                 TextSpan(
                   text: StringName.textSpanAnd,
                   style: TextStyle(
@@ -931,9 +974,11 @@ class StorePage extends BasePage<StoreController> {
                     fontWeight: FontWeight.w400,
                   ),
                 ),
+
                 ClickTextSpan(
-                  text: StringName.textSpanMembershipAgreement,
-                  url: WebUrl.memberServiceAgreement,
+                  text: StringName.textSpanServiceTerms,
+                  url: WebUrl.serviceAgreement,
+                  color: privacyColor,
                 ),
               ],
             ),

+ 2 - 2
lib/widget/platform_util.dart

@@ -12,10 +12,10 @@ class PlatformUtil {
 
   static bool get isAndroid => Platform.isAndroid;
 
-  static bool get isIOS => Platform.isIOS;
+  // static bool get isIOS => Platform.isIOS;
 
   /// 切换注释,就可以用来测试iOS平台的效果
-  // static bool get isIOS => true;
+  static bool get isIOS => true;
 
   static bool get isFuchsia => Platform.isFuchsia;