Flutter Example 消息框提示
2018-11-20 本文已影响2人
三只仓鼠

import 'package:flutter/material.dart';
void main() => runApp(new MaterialApp(
home: new MyHome(),
));
class MyHome extends StatefulWidget {
@override
State<StatefulWidget> createState() => MyHomeState();
}
class MyHomeState extends State<MyHome> {
AlertDialog dialog = new AlertDialog(
content: new Text(
"Hello",
style: new TextStyle(fontSize: 30.0, color: Colors.red),
),
);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Center(
child: new Text("Using Alert Dialog"),
)),
body: new Container(
child: new Center(
child: new RaisedButton(
child: new Text("Hit to Alert"),
onPressed: () {
showDialog(context: context, child: dialog);
}))),
);
}
}