diff --git a/lib/widgets/progress/loading_dialog.dart b/lib/widgets/progress/loading_dialog.dart index a635f5c..0f3ba45 100644 --- a/lib/widgets/progress/loading_dialog.dart +++ b/lib/widgets/progress/loading_dialog.dart @@ -169,3 +169,60 @@ class StatusDialog extends Dialog { return icon; } } + +class WarningDialog extends Dialog { + String text; + + WarningDialog({Key key, @required this.text}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Material( + color: Colors.transparent, + child: WillPopScope( + onWillPop: () => new Future.value(false), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + new Container( +// height: rSize(100), + constraints: BoxConstraints( + minWidth: rSize(200), + ), + padding: new EdgeInsets.only( + top: rSize(5), + bottom: rSize(5), + left: rSize(15), + right: rSize(15)), + decoration: new BoxDecoration( + color: Colors.red, + //用一个BoxDecoration装饰器提供背景图片 + borderRadius: BorderRadius.all(Radius.circular(10.0)), + ), + child: new Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Offstage( + offstage: TextUtils.isEmpty(text), + child: Container( + child: new Container( + constraints: BoxConstraints(maxWidth: 200), + child: new Text(text, + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: AppTextStyle.generate(15 * 2.sp, + fontWeight: FontWeight.w300, + color: Colors.white))), + ), + ), + ], + ), + ), + ], + ) + )); + } +} diff --git a/lib/widgets/progress/re_toast.dart b/lib/widgets/progress/re_toast.dart index 49278e1..a2b67f9 100644 --- a/lib/widgets/progress/re_toast.dart +++ b/lib/widgets/progress/re_toast.dart @@ -40,4 +40,11 @@ class ReToast { toastBuilder: (func) => child, enableKeyboardSafeArea: false, ); + static Function warning({String text}) { + return BotToast.showCustomText(toastBuilder: (func) { + return WarningDialog( + text: text, + ); + }); + } }