import 'package:flutter/material.dart'; class Utils { static Future showAlertDialog(BuildContext context, String msg) async { return showDialog( context: context, barrierDismissible: true, // user must tap button! builder: (BuildContext context) { return AlertDialog( title: const Text('警告 ⚠️'), content: SingleChildScrollView( child: ListBody( children: [ Text(msg), ], ), ), actions: [ TextButton( child: const Text('确定'), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); } }