show static method
@description: 弹窗的大小、样式 @param {} @return {}
Implementation
static void show(BuildContext context,
{Widget? title, Widget? content, List<Widget>? actions}) {
Color backgroudColor = Colors.white;
Color dividerColor = Color.fromRGBO(0, 0, 0, 0.1);
if (SilAlertDialogInfo().mode == AlertDialogMode.Dark) {
backgroudColor = Colors.black;
dividerColor = Color.fromRGBO(255, 255, 255, 0.2);
}
/// 自定义背景颜色
if (SilAlertDialogInfo().backgroundColor != null) {
backgroudColor = SilAlertDialogInfo().backgroundColor!;
}
showDialog(
barrierDismissible: false, // 点击屏幕,弹窗不消失
context: context,
builder: (BuildContext context) {
return AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: SilAlertDialogInfo().horizontalMargin,
vertical: 24.w),
titlePadding: EdgeInsets.fromLTRB(
24.w,
(title == null) ? 0 : SilAlertDialogInfo().titleToTopSpace,
24.w,
0.0),
title: title,
contentPadding: EdgeInsets.zero,
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.fromLTRB(
24.w, (content == null) ? 0 : 8.w, 24.w, 0.0),
child: content),
Padding(
padding:
EdgeInsets.only(top: SilAlertDialogInfo().bottomSpace),
child: Divider(
height: SilAlertDialogInfo().separatorLineHeight,
color: dividerColor)),
],
),
actionsPadding: EdgeInsets.zero,
actions: actions,
actionsAlignment: MainAxisAlignment.spaceAround,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(SilAlertDialogInfo().radius)),
backgroundColor: backgroudColor,
);
});
}