美文网首页Flutter
Flutter Example 消息框提示

Flutter Example 消息框提示

作者: 三只仓鼠 | 来源:发表于2018-11-20 14:05 被阅读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);
                  }))),
    );
  }
}

相关文章

网友评论

    本文标题:Flutter Example 消息框提示

    本文链接:https://www.haomeiwen.com/subject/zmztqqtx.html