Flutter基礎-052-AboutDialog

天色將變發表於2021-03-02
構造方法
const AboutDialog({
    Key key,
    this.applicationName,
    this.applicationVersion,
    this.applicationIcon,
    this.applicationLegalese,
    this.children,
  }) 
複製程式碼
示例

image.png

程式碼
class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: RaisedButton(
          onPressed: () {
            showDialog(
              context: context,
              builder: (BuildContext context) {
                return AboutDialog(
                  applicationName: "Super Stars",
                  applicationVersion: "v1.0",
                  applicationIcon: new Icon(
                    Icons.beenhere,
                    color: Colors.green[200],
                  ),
                  applicationLegalese: "開始偉大",
                  children: <Widget>[
                    Text("無限偉大"),
                    Icon(Icons.add_alarm),
                  ],
                );
              },
            );
          },
          child: Text("click me"),
        ),
      ),
    );
  }
}
複製程式碼

相關文章