31 lines
802 B
Dart
31 lines
802 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class CustomAlertBox extends StatefulWidget {
|
||
|
final String message; // Add a message parameter to the constructor
|
||
|
|
||
|
const CustomAlertBox(
|
||
|
{super.key, required this.message}); // Update the constructor
|
||
|
|
||
|
@override
|
||
|
// ignore: library_private_types_in_public_api
|
||
|
_CustomAlertBoxState createState() => _CustomAlertBoxState();
|
||
|
}
|
||
|
|
||
|
class _CustomAlertBoxState extends State<CustomAlertBox> {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return AlertDialog(
|
||
|
// title: const Text('Alert'),
|
||
|
content: Text(widget.message), // Use the message parameter
|
||
|
actions: [
|
||
|
TextButton(
|
||
|
onPressed: () {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
child: const Text('OK'),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}
|
||
|
}
|