-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalertdialog.dart
35 lines (33 loc) · 1.04 KB
/
alertdialog.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import 'package:flutter/material.dart';
class AlertDialogWidget extends StatelessWidget {
const AlertDialogWidget({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("AlertDialog "),
),
body: Center(
child: TextButton(
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Close'))
],
title: const Text('Flutter Alert Dialog Widget'),
contentPadding: const EdgeInsets.all(20.0),
content: const Text('This is the Alert Dialog'),
),
);
},
child: const Text('Show Alert Dialog'),
),
));
}
}