mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 14:29:22 +00:00
29 lines
645 B
Dart
29 lines
645 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Simple alert dialog
|
|
///
|
|
/// @author Pierre Hubert
|
|
|
|
Future<void> alert(BuildContext context, String? msg) async {
|
|
await showDialog(context: context, builder: (c) => _AlertDialog(msg: msg!));
|
|
}
|
|
|
|
class _AlertDialog extends StatelessWidget {
|
|
final String msg;
|
|
|
|
const _AlertDialog({Key? key, required this.msg}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
content: Text(msg),
|
|
actions: <Widget>[
|
|
MaterialButton(
|
|
child: Text("OK"),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|