Search code examples
flutterdartkeyboardtextfield

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


I want to see what I am typing, but in my code the TextField stays under the keyboard. I´d be pretty reliefed if any of you guys know a solution to move the TextField above the keyboard!

  @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 ',
          ),
          ),
        ],
      ),
    );
  }
}


Solution

  • would suggest you to use flutter's new form widget inside that widget you can pass multiple textformfields widgets .

    Once you Use these 2 widgets , Flutter will automatically take care of keyboard and input everttime you start typing.

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