Flutter Example 消息框提示

《Flutter Example 消息框提示》

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);
                  }))),
    );
  }
}

    原文作者:三只仓鼠
    原文地址: https://www.jianshu.com/p/e52d770a71b1
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞