30 lines
887 B
Dart
Raw Normal View History

2022-09-13 00:11:43 +02:00
import 'package:flutter/material.dart';
2022-09-20 23:04:01 +02:00
2024-12-30 22:51:47 +01:00
mixin ShowAlertDialog {
2024-12-30 22:34:17 +01:00
void showAlertDialog(BuildContext context, String title, String text) {
2022-09-13 00:11:43 +02:00
// Create AlertDialog
AlertDialog dialog = AlertDialog(
2024-12-30 22:34:17 +01:00
title: Text(title),
2022-09-13 00:11:43 +02:00
content: Text(text),
actions: [
ElevatedButton(
child: Text("OK"),
style: ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
textStyle:
TextStyle(fontSize: 15, fontWeight: FontWeight.normal)),
onPressed: () {
Navigator.of(context).pop("Yes, Of course!"); // Return value
}),
],
);
// Call showDialog function to show dialog.
Future futureValue = showDialog(
context: context,
builder: (BuildContext context) {
return dialog;
});
}
}