添加 warning toast

master
zhangmeng 4 years ago
parent 8c20e341e0
commit 1b3473682e

@ -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: <Widget>[
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: <Widget>[
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))),
),
),
],
),
),
],
)
));
}
}

@ -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,
);
});
}
}

Loading…
Cancel
Save