Flutter showaboutdialog

該更新了~
記得收藏學習~
(一)效果圖
在這裏插入圖片描述
master是一個暴殄天物的物種!!!



(二)代碼實現
複製代碼即可達到與本博主一樣的效果,不用感謝~嘻嘻

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
       
        appBar: AppBar(
          backgroundColor: Colors.green,
          title: Text("demo"),
        ),
        body: DialogDemo(),
      ),
    );
  }
}

class DialogDemo extends StatefulWidget {
  @override
  _DialogDemoState createState() => _DialogDemoState();
}

class _DialogDemoState extends State<DialogDemo> {
  _ShowAboutDialog() {
    showAboutDialog(
      context: context,
      applicationIcon: Image.asset("images/master.jpg",
      height: 100,
      width: 100),
      applicationName: "master",
      //applicationVersion: "1.0",
      applicationLegalese: "master是一個非常有能力且帥氣的物種!",
      children: [
        Container(
        margin: EdgeInsets.only(top: 10),
        height: 30,
        color: Colors.red,
      ),
       Container(
        height: 30,
        color: Colors.blue,
      ),
       Container(
        height: 30,
        color: Colors.green,
      )
      ]
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(title: Text("showdialog")),
      body: Container(
        child: RaisedButton(child: Text("dialog"), onPressed:_ShowAboutDialog),
      ),
    );
  }
}


主要用到的就是showaboutdialog這個組件~
裏面的屬性都是可以通過選中該組件左鍵點開裏面的屬性查看的哦,不會的請留言~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章