mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-28 06:30:45 +08:00
32 lines
786 B
Dart
32 lines
786 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class Utils {
|
|
static Future<void> showAlertDialog(BuildContext context, String msg) async {
|
|
|
|
return showDialog<void>(
|
|
context: context,
|
|
barrierDismissible: true, // user must tap button!
|
|
builder: (BuildContext context) {
|
|
return AlertDialog(
|
|
title: const Text('警告 ⚠️'),
|
|
content: SingleChildScrollView(
|
|
child: ListBody(
|
|
children: <Widget>[
|
|
Text(msg),
|
|
],
|
|
),
|
|
),
|
|
actions: <Widget>[
|
|
TextButton(
|
|
child: const Text('确定'),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|