如何使键盘显示在自定义对话框上方?

时间:2019-06-25 17:16:33

标签: flutter dart

我正在为具有窗体的flutter创建一个自定义对话框。

如下:-


Widget build(BuildContext context) {
    return Dialog(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(20.0),
      ),
      child: SingleChildScrollView(
        child: Container(
          height: 500.0,
          width: 500.0,
          decoration: BoxDecoration(
            // color: Colors.greenAccent[400],
            borderRadius: BorderRadius.circular(10.0),
          ),
          child: Column(
            children: <Widget>[
              Container(
                height: 100.0,
                decoration: BoxDecoration(
                  color: Colors.green
                ),
              ),
              Container(
                height: 300.0,
                decoration: BoxDecoration(
                  color: Colors.orange
                ),
                child: Column(
                  children: <Widget>[
                    Container(
                      decoration: BoxDecoration(
                        color: Colors.blue,
                      ),
                      child: Center(
                        child: TextField(

                        ),
                      ),
                    )
                  ],
                )
              ),
              Container(
                decoration: BoxDecoration(
                  color: Colors.green
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

如上所示,我尝试在单个子滚动视图中包装对话框子。但这只会使对话框可滚动。

我希望对话框的大小保持不变,并让键盘显示在对话框上方而不更改其大小。

0 个答案:

没有答案