如何在键入时将 TextField 移动到键盘上方 | Flutter/dart

How do I move a TextField above the keyboard while typing | Flutter/dart

我想查看我正在键入的内容,但在我的代码中,TextField 保留在键盘下方。 如果你们中有人知道将 TextField 移动到键盘上方的解决方案,我会感到非常欣慰!

  @override
  _object1State createState() => _object1State();
}

class _object1State extends State<object1> {
  String insert = '';

  void change_insert(new_text){
    setState(() {
      insert  = new_text;
    });
  } 

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Text(insert),
          TextField(
          onSubmitted: change_insert,
          decoration: InputDecoration(
    labelText: 'click here ',
          ),
          ),
        ],
      ),
    );
  }
}

建议您在该小部件中使用 flutter 的新表单小部件,您可以传递多个 textformfields 小部件。

一旦您使用这 2 个小部件,Flutter 将在您开始输入时自动处理键盘和输入。

https://www.github.com/mrinaljain/flutter_shoping_cart/tree/master/lib%2Fscreens%2Fedit_product_screen.dart