Flutter Example 消息框提示

Flutter Example 消息框提示_第1张图片
import 'package:flutter/material.dart';

void main() => runApp(new MaterialApp(
      home: new MyHome(),
    ));

class MyHome extends StatefulWidget {
  @override
  State createState() => MyHomeState();
}

class MyHomeState extends State {
  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 消息框提示)