showMassageDialog function
void
showMassageDialog(
- BuildContext context,
- String content, {
- String? title,
- String? colorContent,
- String? buttonText = '知道了',
- VoidCallback? onPressed,
- TextStyle? titleStyle,
- bool left = false,
Implementation
void showMassageDialog(BuildContext context, String content,
{String? title,
String? colorContent,
String? buttonText = '知道了',
VoidCallback? onPressed,
TextStyle? titleStyle,
bool left = false}) {
showDialog(
context: context,
barrierDismissible: false,
builder: (ctx) => CupertinoAlertDialog(
title: Text(title ?? "提示", style: titleStyle),
content: GestureDetector(
child: Container(
alignment: left ? Alignment.centerLeft : Alignment.center,
padding: const EdgeInsets.only(top: 10),
child: buildSearchSpan(content, colorContent ?? '',
style: const TextStyle(height: 1.5, color: Colors.black)),
),
),
actions: <Widget>[
CupertinoButton(
child: Text(buttonText ?? "知道了",
style: TextStyle(color: Theme.of(context).primaryColor)),
onPressed: () {
if (onPressed != null) {
onPressed();
} else {
Navigator.pop(context);
}
},
)
],
),
);
}