-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathmain.dart
40 lines (36 loc) · 920 Bytes
/
main.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
36
37
38
39
40
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: MyHome(),
));
}
class MyHome extends StatefulWidget {
@override
MyHomeState createState() => MyHomeState();
}
class MyHomeState extends State<MyHome> {
// Generate dialog
AlertDialog dialog = AlertDialog(
content: Text(
"Hello World!",
style: TextStyle(fontSize: 30.0),
));
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Using Alert Dialog"),
),
body: Container(
child: Center(
child: RaisedButton(
child: Text("Hit to alert!"),
// On press of the button
onPressed: () {
// Show dialog
showDialog(context: context, builder: (BuildContext context) => dialog);
}),
),
));
}
}