25 lines
565 B
Dart
25 lines
565 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class Alert extends StatelessWidget {
|
|
String title;
|
|
String body;
|
|
Function()? dismissAction;
|
|
|
|
Alert(
|
|
{required this.title, required this.body, super.key, this.dismissAction});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
title: Text(title),
|
|
content: Text(body),
|
|
actions: [
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
if (dismissAction != null) dismissAction!.call();
|
|
},
|
|
child: Text("Dismiss"))
|
|
],
|
|
);
|
|
}
|
|
}
|