인프런 - 강의/플루터로 앱 만들기 고고(입문)
18 - Todo App - 1
----___<<<<<
2020. 5. 7. 15:58
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Alert(),
);
}
}
class Alert extends StatefulWidget {
@override
_AlertState createState() => _AlertState();
}
class _AlertState extends State<Alert> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
child: Text("AlertButton"),
onPressed: (){
showAlertDialog(context);
},
),
),
);
}
showAlertDialog(BuildContext context) {
AlertDialog alert = AlertDialog(
title: Text("title"),
content: Text("Context"),
actions: [
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
}
);
}
}