Ver Fonte

add:添加去求助的提示框。

zhoukun há 5 meses atrás
pai
commit
df7c05826e

BIN
assets/images/icon_member_contact_click_help.webp


BIN
assets/images/icon_member_contact_click_help_close.webp


BIN
assets/images/icon_urgent_contact_tip_bg.webp


+ 19 - 0
lib/module/main/main_controller.dart

@@ -41,6 +41,10 @@ import '../../utils/permission_util.dart';
 import '../add_friend/add_friend_page.dart';
 import '../mine/mine_page.dart';
 import '../track/track_page.dart';
+import '../urgent_contact/urgent_contact_click_help_dialog.dart';
+
+///求助提示框记录
+const String _kChickHelpAlertKey = "urgent_chick_help_alder_key";
 
 @injectable
 class MainController extends BaseController {
@@ -335,6 +339,7 @@ class MainController extends BaseController {
     //如果没有紧急联系人,则先进入页面
     if (urgentContactRepository.contactList.isEmpty) {
       UrgentContactPage.start();
+      onShowRequestHelpTip();
       return;
     }
     if (accountRepository.memberIsExpired()) {
@@ -360,6 +365,20 @@ class MainController extends BaseController {
     } else {
       ToastUtil.show(StringName.contactNoDefault);
       UrgentContactPage.start();
+      onShowRequestHelpTip();
+    }
+  }
+
+  //弹出求助提示
+  void onShowRequestHelpTip() {
+    String? memberPageKeyStr = KVUtil.getString(_kChickHelpAlertKey, '');
+    if (memberStatusInfo.value?.expired ==
+        true && (memberPageKeyStr ?? '').isEmpty) {
+      ///永久化存储
+      KVUtil.putString(_kChickHelpAlertKey, _kChickHelpAlertKey);
+      UrgentContactClickHelpDialog.show(confirmOnTap: () {
+        MemberPage.start();
+      });
     }
   }
 

+ 106 - 74
lib/module/member/member_evaluation_pop_up_dialog.dart

@@ -1,97 +1,129 @@
+
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
-import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
-import 'package:location/resource/assets.gen.dart';
+import 'package:get/get.dart';
+import 'package:get/get_core/src/get_main.dart';
+import 'package:location/utils/common_expand.dart';
 
+import '../../resource/assets.gen.dart';
 
 class MemberEvaluationPopUpDialog {
-  static final String _tag = 'MemberEvaluationPopUpDialog';
-
-  static void show(
-      {required VoidCallback payClick, required VoidCallback cancelClick}) {
-    SmartDialog.show(
-        tag: _tag,
-        backDismiss: false,
-        clickMaskDismiss: false,
-        builder: (_) {
-          return _MemberEvaluationPopUpDialogWidget(
-              payClick: payClick, cancelClick: cancelClick);
-        });
-  }
-
-  static void dismiss() {
-    SmartDialog.dismiss(tag: _tag);
+  static void show({
+    VoidCallback? cancelOnTap,
+    VoidCallback? confirmOnTap,}) {
+    Get.dialog(
+        SimpleDialog(
+          titlePadding: EdgeInsets.zero,
+          contentPadding: EdgeInsets.zero,
+          insetPadding: EdgeInsets.zero,
+          backgroundColor:Colors.transparent,
+          children: [
+            MemberPaymentCompletedTipView(
+                cancelOnTap: () {
+                  Get.back();
+                  cancelOnTap!();
+                },
+                confirmOnTap: confirmOnTap)
+          ],
+        )
+    );
   }
 }
 
-class _MemberEvaluationPopUpDialogWidget extends Dialog {
-  final VoidCallback payClick;
-  final VoidCallback cancelClick;
 
-  const _MemberEvaluationPopUpDialogWidget(
-      {required this.payClick, required this.cancelClick});
+class MemberPaymentCompletedTipView extends StatefulWidget {
+  final VoidCallback? cancelOnTap;
+  final VoidCallback? confirmOnTap;
+
+
+  const MemberPaymentCompletedTipView({
+    super.key,
+    this.cancelOnTap,
+    required this.confirmOnTap,
+  });
 
   @override
+  State<MemberPaymentCompletedTipView> createState() => _MemberPaymentCompletedTipViewState();
+}
+
+
+class _MemberPaymentCompletedTipViewState extends State<MemberPaymentCompletedTipView> {
+  @override
   Widget build(BuildContext context) {
+    // TODO: implement build
     return Container(
-      child: IntrinsicHeight(
-        child: Column(
-          children: [
-            Stack(
+      width: 1.sw,
+      margin: EdgeInsets.symmetric(horizontal: 42.w),
+      child: Stack(
+        children: [
+          IntrinsicHeight(
+            child: Column(
               children: [
-                AspectRatio(
-                    aspectRatio: 1110 / 1296,
-                    child: Assets.images.imgMemberUserCancelsContainer
-                        .image(width: 301.w)),
-                Positioned(
-                  top: 360.w,
-                  left: 60.w,
-                  right: 60.w,
-                  child: GestureDetector(
-                    onTap: () {
-                      MemberEvaluationPopUpDialog.dismiss();
-                      payClick();
-                    },
-                    child: Container(
-                      height: 40.w,
-                      decoration: BoxDecoration(
-                        gradient: LinearGradient(
-                          begin: Alignment.centerLeft, // 90度相当于从左到右
-                          end: Alignment.centerRight,
-                          colors: [
-                            Color(0xFF7B7DFF), // #7B7DFF
-                            Color(0xFF6365FF), // #6365FF
-                          ],
-                          stops: [0.0, 1.0],
-                          // 从0%到100%
+                Container(
+                  decoration: BoxDecoration(
+                      color: Colors.transparent,
+                      image: DecorationImage(
+                        image: Assets.images.iconMemberContactClickHelp.provider(),
+                        fit: BoxFit.fill,
+                      )
+                  ),
+                  child: Column(
+                    children: [
+                      SizedBox(
+                        height: 183.w,
+                      ),
+                      GestureDetector(
+                        onTap: () {
+                          Get.back();
+                          widget.confirmOnTap!();
+                        },
+                        child: Container(
+                          decoration: BoxDecoration(
+                            gradient: LinearGradient(
+                              begin: Alignment.centerLeft, // 90度相当于从左到右
+                              end: Alignment.centerRight,
+                              colors: [
+                                Color(0xFF7B7DFF), // #7B7DFF
+                                Color(0xFF6365FF), // #6365FF
+                              ],
+                              stops: [0.0, 1.0],
+                              // 从0%到100%
+                            ),
+                            borderRadius: BorderRadius.circular(40.w / 2.0),
+                          ),
+                          margin: EdgeInsets.symmetric(horizontal: 20.w),
+                          height: 40.w,
+                          alignment: Alignment.center,
+                          child: Text("立即邀请",
+                              style: TextStyle(
+                                  fontSize: 14.sp,
+                                  color: '#FFFFFF'.color,
+                                  fontWeight: FontWeight.w500)
+                          ),
                         ),
-                        borderRadius: BorderRadius.circular(40.w / 2.0),
                       ),
-                      //getPrimaryBtnDecoration(100.w),
-                      child: Center(
-                        child: Text("立即领取",
-                            style: TextStyle(
-                                fontSize: 15.sp, color: Colors.white)),
+                      SizedBox(
+                        height: 20.w,
                       ),
-                    ),
+                    ],
                   ),
-                ),
+                )
               ],
             ),
-            SizedBox(height: 24.w,),
-            Center(
-              child: GestureDetector(
-                onTap: () {
-                  MemberEvaluationPopUpDialog.dismiss();
-                  cancelClick();
-                },
-                child: Assets.images.iconMemberRetainClose
-                    .image(width: 32.w, height: 32.w),
-              ),
-            )
-          ],
-        ),
+          ),
+          Positioned(
+            top: 41.w,
+            right: 16.w,
+            width: 20.w,
+            height: 20.w,
+            child: GestureDetector(
+              onTap: widget.cancelOnTap,
+              child: Assets.images.iconMemberContactClickHelpClose.image(width: 20.w, height: 20.w),
+            ),
+          )
+        ],
       ),
     );
   }
-}
+}

+ 184 - 0
lib/module/urgent_contact/urgent_contact_click_help_dialog.dart

@@ -0,0 +1,184 @@
+
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:get/get.dart';
+import 'package:get/get_core/src/get_main.dart';
+import 'package:location/resource/colors.gen.dart';
+import 'package:location/utils/common_expand.dart';
+
+import '../../resource/assets.gen.dart';
+
+class UrgentContactClickHelpDialog {
+  static void show({
+    VoidCallback? cancelOnTap,
+    VoidCallback? confirmOnTap,}) {
+    Get.dialog(
+        SimpleDialog(
+          titlePadding: EdgeInsets.zero,
+          contentPadding: EdgeInsets.zero,
+          insetPadding: EdgeInsets.zero,
+          backgroundColor:Colors.transparent,
+          children: [
+            MemberPaymentCompletedTipView(
+                cancelOnTap: () {
+                  Get.back();
+                  cancelOnTap!();
+                },
+                confirmOnTap: confirmOnTap)
+          ],
+        )
+    );
+  }
+}
+
+class MemberPaymentCompletedTipView extends StatefulWidget {
+  final VoidCallback? cancelOnTap;
+  final VoidCallback? confirmOnTap;
+
+
+  const MemberPaymentCompletedTipView({
+    super.key,
+    this.cancelOnTap,
+    required this.confirmOnTap,
+  });
+
+  @override
+  State<MemberPaymentCompletedTipView> createState() => _MemberPaymentCompletedTipViewState();
+}
+
+class _MemberPaymentCompletedTipViewState extends State<MemberPaymentCompletedTipView> {
+  @override
+  Widget build(BuildContext context) {
+    // TODO: implement build
+    return Container(
+      width: 1.sw,
+      margin: EdgeInsets.symmetric(horizontal: 42.w),
+      child: IntrinsicHeight(
+        child: Column(
+          children: [
+            Container(
+              decoration: BoxDecoration(
+                  color: Colors.transparent,
+                  image: DecorationImage(
+                    image: Assets.images.iconUrgentContactTipBg.provider(),
+                    fit: BoxFit.fill,
+                  )
+              ),
+              child: Column(
+                children: [
+                  SizedBox(
+                    height: 150.w,
+                  ),
+                  Text("使用一键求助",
+                      style: TextStyle(
+                          fontSize: 20.sp,
+                          color: "#333333".color,
+                          fontWeight: FontWeight.bold)),
+                  SizedBox(height: 8.w,),
+                  Row(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    children: [
+                      Container(
+                        decoration: BoxDecoration(
+                          gradient: LinearGradient(
+                            // 渐变方向:90度(从左到右)
+                            begin: Alignment.centerLeft,
+                            end: Alignment.centerRight,
+                            // 渐变颜色:从透明灰到#AAA
+                            colors: [
+                              Color.fromRGBO(170, 170, 170, 0.0), // rgba(170, 170, 170, 0.00)
+                              Color(0xFFAAAAAA), // #AAA
+                            ],
+                            // 渐变位置:0%到100%
+                            stops: [0.0, 1.0],
+                          ),
+                        ),
+                        width: 14.w,
+                        height: 1.w,
+                      ),
+                      SizedBox(width: 6.w,),
+                      Text("紧急情况,快速求助",
+                          style: TextStyle(fontSize: 12.sp, color: ColorName.black60)),
+                      SizedBox(width: 6.w,),
+                      Container(
+                        width: 14.w,
+                        height: 1.w,
+                        decoration: BoxDecoration(
+                          gradient: LinearGradient(
+                            // 90度渐变(从左到右)
+                            begin: Alignment(-1.0, 0.0), // 左侧起点
+                            end: Alignment(1.0, 0.0),   // 右侧终点
+                            // 渐变颜色:透明灰到#AAA
+                            colors: [
+                              Color.fromARGB(0, 170, 170, 170), // rgba(170, 170, 170, 0.00)
+                              Color(0xFFAAAAAA),               // #AAA
+                            ],
+                            // 颜色分布位置
+                            stops: [0.0, 1.0],
+                          ),
+                        ),
+                      )
+                    ],
+                  ),
+                  SizedBox(
+                    height: 32.w,
+                  ),
+                  GestureDetector(
+                    onTap: () {
+                      Get.back();
+                      widget.confirmOnTap!();
+                    },
+                    child: Container(
+                      decoration: BoxDecoration(
+                        gradient: LinearGradient(
+                          begin: Alignment.centerLeft, // 90度相当于从左到右
+                          end: Alignment.centerRight,
+                          colors: [
+                            Color(0xFF7B7DFF), // #7B7DFF
+                            Color(0xFF6365FF), // #6365FF
+                          ],
+                          stops: [0.0, 1.0],
+                          // 从0%到100%
+                        ),
+                        borderRadius: BorderRadius.circular(40.w / 2.0),
+                      ),
+                      margin: EdgeInsets.symmetric(horizontal: 20.w),
+                      height: 40.w,
+                      alignment: Alignment.center,
+                      child: Text("立即求助",
+                          style: TextStyle(
+                              fontSize: 14.sp,
+                              color: '#FFFFFF'.color,
+                              fontWeight: FontWeight.w500)
+                      ),
+                    ),
+                  ),
+                  SizedBox(
+                    height: 10.w,
+                  ),
+                  GestureDetector(
+                    onTap: widget.cancelOnTap,
+                    child: Container(
+                      height: 20.w,
+                      child: Text("下次再说",
+                          style: TextStyle(
+                              fontSize: 11.sp,
+                              color: '#898996'.color,
+                              fontWeight: FontWeight.w500)
+                      ),
+                    ),
+                  ),
+
+                  SizedBox(
+                    height: 12.w,
+                  ),
+                ],
+              ),
+            )
+          ],
+        ),
+      ),
+    );
+  }
+}

+ 15 - 0
lib/resource/assets.gen.dart

@@ -252,6 +252,14 @@ class $AssetsImagesGen {
   AssetGenImage get iconMemberAvatar =>
       const AssetGenImage('assets/images/icon_member_avatar.webp');
 
+  /// File path: assets/images/icon_member_contact_click_help.webp
+  AssetGenImage get iconMemberContactClickHelp =>
+      const AssetGenImage('assets/images/icon_member_contact_click_help.webp');
+
+  /// File path: assets/images/icon_member_contact_click_help_close.webp
+  AssetGenImage get iconMemberContactClickHelpClose => const AssetGenImage(
+      'assets/images/icon_member_contact_click_help_close.webp');
+
   /// File path: assets/images/icon_member_fun5.webp
   AssetGenImage get iconMemberFun5 =>
       const AssetGenImage('assets/images/icon_member_fun5.webp');
@@ -432,6 +440,10 @@ class $AssetsImagesGen {
   AssetGenImage get iconUrgentContactMore =>
       const AssetGenImage('assets/images/icon_urgent_contact_more.webp');
 
+  /// File path: assets/images/icon_urgent_contact_tip_bg.webp
+  AssetGenImage get iconUrgentContactTipBg =>
+      const AssetGenImage('assets/images/icon_urgent_contact_tip_bg.webp');
+
   /// File path: assets/images/icon_vip.webp
   AssetGenImage get iconVip =>
       const AssetGenImage('assets/images/icon_vip.webp');
@@ -538,6 +550,8 @@ class $AssetsImagesGen {
         iconMainRefreshMineLocation,
         iconMainTrackArrow,
         iconMemberAvatar,
+        iconMemberContactClickHelp,
+        iconMemberContactClickHelpClose,
         iconMemberFun5,
         iconMemberFun1,
         iconMemberFun2,
@@ -583,6 +597,7 @@ class $AssetsImagesGen {
         iconUrgentContactAdd,
         iconUrgentContactDialPhone,
         iconUrgentContactMore,
+        iconUrgentContactTipBg,
         iconVip,
         iconWechatPayment,
         iconWechatScanPayment,