showConfirmBasicDialog static method
void
showConfirmBasicDialog(
- BuildContext context,
- String message, {
- String cancelMsg = "取消",
- String confirmMsg = "确认",
- String title = "",
- TextStyle? messageStyle,
- required VoidCallback onTapConfirm,
- required VoidCallback onTapCancel,
Implementation
static void showConfirmBasicDialog(
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);
YYDialog yydialog;
yydialog = YYDialog().build(context)
..width = totalWidth
..height = totalHeight
..borderRadius = 20.r
..backgroundColor = Colors.transparent
..barrierDismissible = false
..widget(Container(
// color: Colors.red,
width: totalWidth,
height: totalHeight,
child: Stack(
children: [
//content
Column(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20.r)),
child: Container(
color: Colors.white,
height: 240.h,
width: totalWidth,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 20.h,
),
Icon(Icons.warning,color: Colors.red,),
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,
),
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 15.w, right: 15.w),
height: 60.h,
child: Row(
children: [
Expanded(
flex: 1,
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GFButton(
onPressed: () {
onTapCancel.call();
},
text: "No",
color: Colors.grey,
shape: GFButtonShape.pills,
)
],
),
),
),
SizedBox(
width: 10.w,
),
Expanded(
flex: 1,
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GFButton(
onPressed: () {
onTapConfirm.call();
},
text: "Yes",
shape: GFButtonShape.pills,
)
],
),
),
),
],
),
),
],
),
),
),
],
),
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!);
}),
))
],
),
))
..show();
}