From 70a344485bd0c9b68ac91f72ed23ec5bfa998b09 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 25 十一月 2021 19:30:25 +0800
Subject: [PATCH] 功能完善

---
 lib/ui/widget/dialog.dart |  130 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 103 insertions(+), 27 deletions(-)

diff --git a/lib/ui/widget/dialog.dart b/lib/ui/widget/dialog.dart
index 002bd7a..ff34893 100644
--- a/lib/ui/widget/dialog.dart
+++ b/lib/ui/widget/dialog.dart
@@ -2,7 +2,9 @@
 
 import 'package:flutter/material.dart';
 import 'package:flutter_html/flutter_html.dart';
+import 'package:flutter_spinkit/flutter_spinkit.dart';
 import 'package:html/dom.dart' as dom;
+import 'package:locations/utils/ui_constant.dart';
 
 //閫氱敤寮规
 class NotifyDialog extends Dialog {
@@ -424,16 +426,21 @@
   final ListView listView;
   final GestureTapCallback onClose;
   final double maxHeight;
+  final double? dwidth;
 
-  ListViewDialog(this.listView, this.onClose, {this.maxHeight = 420});
+  ListViewDialog(this.listView, this.onClose,
+      {this.maxHeight = 420, this.dwidth});
 
   @override
   Widget build(BuildContext context) {
     this.context = context;
-    double width = MediaQuery.of(context).size.width;
-    double dialogWidth = width - 20;
-    print("灞忓箷瀹斤細$width");
+    double swidth = MediaQuery.of(context).size.width;
 
+    double dialogWidth = swidth - 20;
+    print("灞忓箷瀹斤細$swidth");
+    if (dwidth != null) {
+      dialogWidth = dwidth!;
+    }
     //鍏抽棴寮规
     // Navigator.pop(context);
     return WillPopScope(
@@ -446,30 +453,99 @@
                 alignment: Alignment.center,
                 child: Column(
                     mainAxisAlignment: MainAxisAlignment.center,
-                    mainAxisSize:MainAxisSize.min,
+                    mainAxisSize: MainAxisSize.min,
                     children: [
-                  ClipRRect(
-                      borderRadius: BorderRadius.circular(10),
-                      child: Container(
-                        constraints: BoxConstraints(maxHeight: maxHeight),
-                        color: Colors.white,
-                        alignment: Alignment.topCenter,
-                        width: dialogWidth,
-                        child: listView,
-                      )),
-                  Container(
-                    height: 20,
-                  ),
-                  InkWell(
-                    child: Image.asset(
-                      "assets/images/common/icon_dialog_close.png",
-                      height: 32,
-                      width: 32,
+                      ClipRRect(
+                          borderRadius: BorderRadius.circular(10),
+                          child: Container(
+                            constraints: BoxConstraints(maxHeight: maxHeight),
+                            color: Colors.white,
+                            alignment: Alignment.topCenter,
+                            width: dialogWidth,
+                            child: listView,
+                          )),
+                      Container(
+                        height: 20,
+                      ),
+                      InkWell(
+                        child: Image.asset(
+                          "assets/images/common/icon_dialog_close.png",
+                          height: 32,
+                          width: 32,
+                        ),
+                        onTap: () {
+                          onClose();
+                        },
+                      ),
+                    ]))));
+  }
+}
+
+///ListView寮规
+class LoadingDialog extends Dialog {
+  BuildContext? context;
+  final String? text;
+
+  LoadingDialog(this.text);
+
+  @override
+  Widget build(BuildContext context) {
+    this.context = context;
+
+    //鍏抽棴寮规
+    // Navigator.pop(context);
+    return WillPopScope(
+        onWillPop: () async {
+          return false;
+        },
+        child: const Material(
+            type: MaterialType.transparency,
+            child: Align(
+                alignment: Alignment.center,
+                child: SpinKitCircle(
+                  color: ColorConstant.theme,
+                  size: 80.0,
+                ))));
+  }
+}
+
+class CustomDialog extends Dialog {
+  BuildContext? context;
+  final Widget contentWidget;
+
+  CustomDialog(this.contentWidget);
+
+  @override
+  Widget build(BuildContext context) {
+    this.context = context;
+    //鍏抽棴寮规
+    // Navigator.pop(context);
+    return WillPopScope(
+        onWillPop: () async {
+          return false;
+        },
+        child: Material(
+            type: MaterialType.transparency,
+            child: Align(
+                alignment: Alignment.center,
+                child: Column(
+                  mainAxisSize: MainAxisSize.min,
+                  crossAxisAlignment: CrossAxisAlignment.center,
+                  children: [
+                    contentWidget,
+                    Container(
+                      height: 20,
                     ),
-                    onTap: () {
-                      onClose();
-                    },
-                  ),
-                ]))));
+                    InkWell(
+                        onTap: () {
+                          Navigator.of(context).pop();
+                        },
+                        child: Image.asset(
+                          "assets/images/common/icon_dialog_close.png",
+                          height: 32,
+                          width: 32,
+                        ))
+                  ],
+                ))));
   }
 }

--
Gitblit v1.8.0