向上移动Flutter AlertDialog

时间:2018-03-19 13:13:27

标签: dart flutter

我正在尝试用Flutter.io做点什么 但我有一些问题。我的行动没有详细记录。

我想获得一个带有AlertDialog的Android应用程序。但是我的键盘在Alertdialog上面。所以我找到了一种解决方法,当键盘打开时按下Dialog,但我真的不明白。

所以我的计划是提升AlertDialog。它的核心是当下。我想在“AlertDialog”中添加一个Margin底部。

这是我的功能,如果我点击Fabbutton,它将打开Dialog。

void _openNewInputPopup() {
    print("popup will open");

    AlertDialog dialog = new AlertDialog(
      content: new SingleChildScrollView(
        child: new Column(
          children: <Widget>[
            new Text('Wie lautet das Versteck?',
            style: new TextStyle(fontSize: 18.0),),
            new TextField(onChanged: (String value) {
              {
                print("changed $value");
              }
            },),
          ],
        ),
      ),

      actions: <Widget> [
        new FlatButton(onPressed: () {
          _dialogResult(MyDialogAction.Abbrechen);
        }, child: new Text('Abbrechen')),

        new FlatButton(onPressed: () {
          _dialogResult(MyDialogAction.Anlegen);
          }, child: new Text('Anlegen')),
      ]
    );


    showDialog(context: context, child: dialog);
  }

如果你们中的某个人有更多的扑动经验并且可以帮助我,那将是非常好的。谢谢

2 个答案:

答案 0 :(得分:0)

我根据文本字段是否具有焦点来调整填充。希望对您有所帮助。

if(!isset($_REQUEST['alert']){
    header("Location: ".{$_SERVER['PHP_SELF']}."?alert=xxxx");
}

答案 1 :(得分:0)

在父小部件的底部添加填充或边距:

margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),

OR

padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),

并将resizeToAvoidBottomInset: false,添加到您的脚手架小部件