Selaa lähdekoodia

[new]补充会员页

Destiny 1 vuosi sitten
vanhempi
commit
ca27505e02
3 muutettua tiedostoa jossa 305 lisäystä ja 63 poistoa
  1. 7 0
      ios/Podfile.lock
  2. 69 63
      lib/module/store/view.dart
  3. 229 0
      lib/widget/alert_dialog.dart

+ 7 - 0
ios/Podfile.lock

@@ -11,12 +11,16 @@ PODS:
   - path_provider_foundation (0.0.1):
     - Flutter
     - FlutterMacOS
+  - record_darwin (1.0.0):
+    - Flutter
+    - FlutterMacOS
 
 DEPENDENCIES:
   - Flutter (from `Flutter`)
   - mmkv_ios (from `.symlinks/plugins/mmkv_ios/ios`)
   - package_info (from `.symlinks/plugins/package_info/ios`)
   - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
+  - record_darwin (from `.symlinks/plugins/record_darwin/ios`)
 
 SPEC REPOS:
   trunk:
@@ -32,6 +36,8 @@ EXTERNAL SOURCES:
     :path: ".symlinks/plugins/package_info/ios"
   path_provider_foundation:
     :path: ".symlinks/plugins/path_provider_foundation/darwin"
+  record_darwin:
+    :path: ".symlinks/plugins/record_darwin/ios"
 
 SPEC CHECKSUMS:
   Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
@@ -40,6 +46,7 @@ SPEC CHECKSUMS:
   MMKVCore: af055b00e27d88cd92fad301c5fecd1ff9b26dd9
   package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
   path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
+  record_darwin: df0a677188e5fed18472550298e675f19ddaffbe
 
 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
 

+ 69 - 63
lib/module/store/view.dart

@@ -22,48 +22,51 @@ class StorePage extends BasePage<StoreController> {
   Widget buildBody(BuildContext context) {
     return Stack(
       children: [
-        Stack(
-          alignment: AlignmentDirectional.topStart,
-          children: [
-            _buildBackgroundGradient(),
-            _buildTopBG(),
-            Positioned(
-              left: 12.w,
-              top: 280,
-              width: ScreenUtil().screenWidth - 24.w,
-              child: Column(
-                crossAxisAlignment: CrossAxisAlignment.start,
-                children: [
-                  SizedBox(
-                    height: 20.h,
-                    child: Assets.images.iconStoreDescripe.image(),
-                  ),
-                  SizedBox(
-                    height: 16.h,
-                  ),
-                  _buildGoods(),
-                  SizedBox(
-                    height: 16.h,
-                  ),
-                  Text(
-                    "·该套餐约可倾听45小时",
-                    style: TextStyle(
-                      fontSize: 10.sp,
-                      color: "#AFAFAF".toColor(),
+        SingleChildScrollView(
+          scrollDirection: Axis.vertical,
+          child: Stack(
+            alignment: AlignmentDirectional.topStart,
+            children: [
+              _buildBackgroundGradient(),
+              _buildTopBG(),
+              Positioned(
+                left: 12.w,
+                top: 280,
+                width: ScreenUtil().screenWidth - 24.w,
+                child: Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [
+                    SizedBox(
+                      height: 20.h,
+                      child: Assets.images.iconStoreDescripe.image(),
                     ),
-                  ),
-                  SizedBox(
-                    height: 16.h,
-                  ),
-                  _buildPayMethod(),
-                  SizedBox(
-                    height: 39.h,
-                  ),
-                  _buildService(),
-                ],
+                    SizedBox(
+                      height: 16.h,
+                    ),
+                    _buildGoods(),
+                    SizedBox(
+                      height: 16.h,
+                    ),
+                    Text(
+                      "·该套餐约可倾听45小时",
+                      style: TextStyle(
+                        fontSize: 10.sp,
+                        color: "#AFAFAF".toColor(),
+                      ),
+                    ),
+                    SizedBox(
+                      height: 16.h,
+                    ),
+                    _buildPayMethod(),
+                    SizedBox(
+                      height: 39.h,
+                    ),
+                    _buildService(),
+                  ],
+                ),
               ),
-            ),
-          ],
+            ],
+          ),
         ),
         _buildTopBar(),
         Positioned(
@@ -159,19 +162,24 @@ class StorePage extends BasePage<StoreController> {
   }
 
   Widget _buildGoods() {
-    return ListView.builder(
-      padding: const EdgeInsets.only(top: 0),
-      physics: const NeverScrollableScrollPhysics(),
-      itemBuilder: (context, index) {
-        return _buildGoodItem();
-      },
-      itemCount: 2,
+    return SizedBox(
+      height: 154,
+      child: ListView.builder(
+        scrollDirection: Axis.horizontal,
+        padding: const EdgeInsets.only(top: 0),
+        itemBuilder: (context, index) {
+          return _buildGoodItem();
+        },
+        itemCount: 4,
+      ),
     );
   }
 
   Widget _buildGoodItem() {
     return Container(
       height: 154,
+      width: 132,
+      margin: const EdgeInsets.only(right: 10),
       child: Stack(
         clipBehavior: Clip.none,
         children: [
@@ -262,23 +270,21 @@ class StorePage extends BasePage<StoreController> {
                         ),
                         borderRadius: BorderRadius.circular(12),
                       ),
-                      child: Expanded(
-                        child: Row(
-                          mainAxisSize: MainAxisSize.min,
-                          children: [
-                            SizedBox(
-                              width: 16,
-                              child: Assets.images.iconStoreGoodFlash.image(),
+                      child: Row(
+                        mainAxisSize: MainAxisSize.min,
+                        children: [
+                          SizedBox(
+                            width: 16,
+                            child: Assets.images.iconStoreGoodFlash.image(),
+                          ),
+                          Text(
+                            "550电量",
+                            style: TextStyle(
+                              fontSize: 13,
+                              color: Colors.white,
                             ),
-                            Text(
-                              "550电量",
-                              style: TextStyle(
-                                fontSize: 13,
-                                color: Colors.white,
-                              ),
-                            )
-                          ],
-                        ),
+                          )
+                        ],
                       ),
                     )
                   ],

+ 229 - 0
lib/widget/alert_dialog.dart

@@ -0,0 +1,229 @@
+import 'package:electronic_assistant/popup/talk_popup.dart';
+import 'package:electronic_assistant/utils/expand.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+
+class EAAlertDialog {
+  static void show({
+    String? title,
+    String? contentText,
+    Widget? contentWidget,
+    String? confirmText,
+    String? cancelText,
+    VoidCallback? cancelOnTap,
+    VoidCallback? confirmOnTap,
+    VoidCallback? onDismiss,
+  }) {
+    SmartDialog.show(
+      builder: (_) {
+        return _EAAlertDialog(
+            title: title,
+            content: contentText,
+            contentWidget: contentWidget,
+            confirmText: confirmText,
+            cancelText: cancelText,
+            confirmOnTap: confirmOnTap,
+            cancelOnTap: cancelOnTap);
+      },
+      tag: "EAAlertDialog",
+      onDismiss: onDismiss,
+      clickMaskDismiss: false,
+    );
+  }
+
+  static void dismiss() {
+    SmartDialog.dismiss(tag: "EAAlertDialog");
+  }
+}
+
+class _EAAlertDialog extends Dialog {
+  // 标题
+  final String? title;
+
+  final Widget? contentWidget;
+
+  // 内容
+  final String? content;
+
+  // 取消按钮文字
+  final String? cancelText;
+
+  // 取消按钮回调
+  final VoidCallback? cancelOnTap;
+
+  // 确认按钮文字
+  final String? confirmText;
+
+  // 确认按钮文字回调
+  final VoidCallback? confirmOnTap;
+
+  const _EAAlertDialog({
+    this.title,
+    this.content,
+    this.contentWidget,
+    required this.cancelText,
+    required this.confirmText,
+    this.cancelOnTap,
+    this.confirmOnTap,
+  });
+
+  @override
+  Widget build(BuildContext context) {
+    return Center(
+      child: Column(
+        children: [
+          const Spacer(),
+
+          Container(
+            alignment: Alignment.center,
+            padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w),
+            width: ScreenUtil().screenWidth - 80.w,
+            decoration: BoxDecoration(
+              borderRadius: BorderRadius.all(Radius.circular(12.w)),
+              color: "#FFFFFF".toColor(),
+            ),
+            child: Column(
+              mainAxisAlignment: MainAxisAlignment.center,
+              children: [
+                /// 标题
+                if (title != null)
+                  Text(
+                    title!,
+                    style: TextStyle(
+                      color: "#25262A".toColor(),
+                      fontSize: 15.sp,
+                      fontWeight: FontWeight.w500,
+                      decoration: TextDecoration.none,
+                    ),
+                  ),
+
+                if (title != null) SizedBox(height: 12.h),
+
+                if (content != null)
+
+                  /// 内容
+                  Text(
+                    content ?? "",
+                    textAlign: TextAlign.center,
+                    style: TextStyle(
+                      color: "#5F5F61".toColor(),
+                      fontWeight: FontWeight.w500,
+                      fontSize: 14.sp,
+                      decoration: TextDecoration.none,
+                    ),
+                  ),
+
+                if (contentWidget != null) contentWidget!,
+
+                SizedBox(height: 34.h),
+
+                ///
+                _buttonWidget(context),
+              ],
+            ),
+          ),
+
+          //
+          const Spacer(),
+        ],
+      ),
+    );
+  }
+
+  Widget _buttonWidget(BuildContext context) {
+    if (cancelText == null) {
+      return Row(
+        children: [
+          const Spacer(),
+
+          ///确认按钮
+          GestureDetector(
+            onTap: () {
+              _clickConfirm();
+            },
+            child: _button(text: confirmText ?? "", color: "#6177F2".toColor()),
+          ),
+
+          //
+          const Spacer(),
+        ],
+      );
+    } else {
+      return Row(
+        children: [
+          ///  取消按钮
+          Expanded(
+            child: InkWell(
+              onTap: () {
+                _clickCancel();
+              },
+              child: _button(
+                text: cancelText ?? "",
+                color: "#F0F0F0".toColor(),
+                textColor: "#5F5F61".toColor(),
+              ),
+            ),
+          ),
+
+          ///
+          const SizedBox(width: 8),
+
+          /// 确认按钮
+          Expanded(
+            child: InkWell(
+              onTap: () {
+                _clickConfirm();
+              },
+              child:
+                  _button(text: confirmText ?? "", color: "#6177F2".toColor()),
+            ),
+          ),
+        ],
+      );
+    }
+  }
+
+  Widget _button({
+    required String text,
+    Color? color,
+    BoxBorder? border,
+    Color? textColor = Colors.white,
+  }) {
+    return Container(
+      height: 36.w,
+      decoration: BoxDecoration(
+        borderRadius: BorderRadius.all(Radius.circular(8.w)),
+        color: color,
+        border: border,
+      ),
+      alignment: Alignment.center,
+      child: Text(
+        text,
+        style: TextStyle(
+          color: textColor,
+          fontSize: 14.sp,
+          fontWeight: FontWeight.w500,
+        ),
+      ),
+    );
+  }
+
+  void _clickConfirm() {
+    EAAlertDialog.dismiss();
+
+    if (confirmOnTap != null) {
+      confirmOnTap!();
+    }
+  }
+
+  void _clickCancel() {
+    EAAlertDialog.dismiss();
+
+    if (cancelOnTap != null) {
+      cancelOnTap!();
+    }
+  }
+}