showBasicDialog static method
void
showBasicDialog(
- BuildContext context,
- String message, {
- String cancelMsg = "取消",
- String confirmMsg = "确认",
- String title = "",
- TextStyle? messageStyle,
- required VoidCallback onTapConfirm,
- required VoidCallback onTapCancel,
Implementation
static void showBasicDialog(
BuildContext context,
String message, {
String cancelMsg = "取消",
String confirmMsg = "确认",
String title = "",
TextStyle? messageStyle,
required VoidCallback onTapConfirm,
required VoidCallback onTapCancel,
}) {
title = (title.isEmpty ? "tips".tr : title);
confirmMsg = "confirm".tr;
cancelMsg = "cancel".tr;
messageStyle = messageStyle ?? GoogleFonts.roboto(color: Colors.black, fontSize: 12.sp, fontWeight: FontWeight.w400);
if (message == currentDialogMessage && currentDialogShowing == true) {
return;
}
YYDialog yydialog = YYDialog().build(context)
..width = totalWidth
..height = totalHeight
..borderRadius = 20.r
..backgroundColor = Colors.transparent
..widget(Container(
// color: Colors.red,
width: totalWidth,
height: totalHeight,
child: Stack(
children: [
//content
Container(
// color: Colors.green,
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20.r)),
child: Container(
color: Colors.white,
height: 180.h,
width: totalWidth,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 20.h,
),
Image.asset(
"images/coffee.gif",
width: 80.w,
height: 60.h,
),
Text(
title,
textAlign: TextAlign.center,
style: GoogleFonts.roboto(
color: Colors.black,
fontSize: 17.sp,
fontWeight: FontWeight.w500,
),
),
SizedBox(
height: 10.h,
),
Text(
message,
textAlign: TextAlign.center,
style: messageStyle,
),
],
),
),
),
],
),
),
Align(
alignment: Alignment.topRight,
child: Padding(
padding: EdgeInsets.only(right: 5.w, top: 10.h),
child: const Icon(
Icons.close_outlined,
color: Color(0xffc0c0c0),
),
)).prop(onTap: () {
Navigator.pop(Get.context!);
})
],
),
))
..dismissCallBack = () {
currentDialogMessage = "";
currentDialogShowing = false;
}
..show();
currentDialogMessage = message;
currentDialogShowing = true;
}