美文网首页flutterios
Flutter之AlertDialog组件

Flutter之AlertDialog组件

作者: 习惯了_就好 | 来源:发表于2019-03-20 16:29 被阅读0次
    /**
     * 提示对话框,显示提示内容和操作按钮
     * const AlertDialog({
        Key key,
        this.title,//标题
        this.titlePadding,//标题间距
        this.content,//要显示的内容项
        this.contentPadding = const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),//内容间距
        this.actions,//底部按钮
        this.semanticLabel,//
        this.shape,//
        })
     */
    
    body: RaisedButton(
              onPressed: () {
                showDialog(
                    context: context,
                    builder: (BuildContext context) {
                      return AlertDialog(
                        title: Text("这是标题"),
                        titlePadding: EdgeInsets.only(bottom: 30.0, left: 10.0),
                        content: SingleChildScrollView(
                          child: ListBody(
                            children: <Widget>[
                              Text("这是第一行"),
                              Text("这是第二行"),
                              Text("这是第三行"),
                            ],
                          ),
                        ),
                        contentPadding: EdgeInsets.only(left: 40.0),
                        actions: <Widget>[
                          FlatButton(
                              onPressed: () {},
                              child: Text("取消")
                          ),
                          RaisedButton(
                            onPressed: () {},
                            child: Text(
                              "确定",
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
    
                        ],
                      );
                    }
                );
              },
              child: Text("点击显示AlertDialog"),
            ),
    

    相关文章

      网友评论

        本文标题:Flutter之AlertDialog组件

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