| | |
| | | |
| | | 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 { |
| | |
| | | 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( |
| | |
| | | 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, |
| | | )) |
| | | ], |
| | | )))); |
| | | } |
| | | } |