如何在颤振器上堆叠键盘

时间:2018-12-23 09:08:43

标签: keyboard flutter stack

当前,我有一个小部件的列表视图,并且在底部的“堆栈顶部”放置一个底部按钮以始终显示。但是当我点击文本框时,底部的按钮在顶部被按下,这非常丑陋。如何将键盘按在Button上?

谢谢你 enter image description here

这是一个代码示例:

FROM rust:latest
...
RUN useradd -ms /bin/bash myuser
USER myuser

1 个答案:

答案 0 :(得分:0)

我建议将“按钮”放在floatingActionButton内堆栈底部的底部。

floatingActionButton: FloatingActionButton.extended(
            elevation: 4.0,
            label: Text(Appliquer),
            onPressed: () {},
          ),
floatingActionButtonLocation:
              FloatingActionButtonLocation.centerDocked,

添加了代码修改后
正如我在评论中所说,我会在AppBar中使用FloatingActionButton / BottomNaviagtionBar或Save-Icon

在这里,我将FloatingActionButton添加到您的代码中:

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _controller = new TextEditingController();

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(),
        body: new Stack(children: <Widget>[
          new ListView(
            children: <Widget>[
              new Column(
                children: <Widget>[
                  new Padding(
                    padding: const EdgeInsets.all(100.0),
                  ),
                  new Card(
                    child: new Padding(
                      padding: const EdgeInsets.all(10.0),
                      child: new Row(
                        children: <Widget>[
                          new Expanded(
                            child: new TextField(
                              controller: _controller,
                              decoration: new InputDecoration(
                                  hintText: "Enter an address"),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),

                ],
              )
            ],
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton.extended(
        icon: Icon(Icons.save), label: 
        new Text('Appliquer'), 
        onPressed: () { /*perform your Action here*/ },
      ),
    );
  }
} 
相关问题