yShowBuilder function
void
yShowBuilder(
- String message,
- dynamic confirmCallBack(),
- dynamic cancelCallBack()?,
- bool cancelAble, {
- String posTitle = "确定",
- String negTitle = "取消",
- BuildContext? context,
弹出对话框
Implementation
void yShowBuilder(String message, Function() confirmCallBack, Function()? cancelCallBack, bool cancelAble, {String posTitle = "确定", String negTitle = "取消", BuildContext? context}) async {
showDialog(
context: context ?? yPages.last.context,
barrierDismissible: false,
builder: (context) {
return WillPopScope(
onWillPop: () => Future.value(false),
child: AlertDialog(
title: Text("${YConfig.appName}提示", style: const TextStyle(color: Colors.black)),
content: SingleChildScrollView(child: Text(message, style: const TextStyle(color: Colors.black))),
actions: [
_YFlatButton(Text(posTitle, style: const TextStyle(color: Colors.black)), onClick: () {
confirmCallBack();
Navigator.of(context).pop();
}),
Offstage(
offstage: !cancelAble && cancelCallBack == null,
child: _YFlatButton(
Text(negTitle, style: const TextStyle(color: Colors.black)),
onClick: cancelCallBack != null
? () {
cancelCallBack();
Navigator.of(context).pop();
}
: () {
Navigator.of(context).pop();
},
),
),
],
),
);
},
);
}