0

my problem is exactly this; When the application I wrote with flutter works with the emulator, the body resizes when the keyboard is opened, but when I connect a real phone and try it, the keyboard hides the text fields.

Need to set a permission?

SpeedyG1481
  • 49
  • 1
  • 4
  • Can you please share the code? – Hamza Jan 25 '21 at 15:31
  • Please add a code snippet of the widget that opens the keyboard. You should test your app in release mode over the physical device in order to check any error, maybe on your emulator the screen fits well and on your physical device it doesn't – Ronald Petit Jan 25 '21 at 15:36

2 Answers2

1

I got the similar problem inside scrollable widget, the solution is to wrap your widget with Padding like that:

@override
Widget build(BuildContext context) {
  final bottom = MediaQuery.of(context).viewInsets.bottom;
  return SingleChildScrollView(
          controller: widget.controller,
          child: Padding(
            padding: EdgeInsets.only(bottom: bottom),
            child: YourWidgetWithTextFields()
  );
}
Kelidon
  • 228
  • 1
  • 12
  • I tried doing this but it didn't work, then I tried deleting the true part in styles.xml file in a different place. – SpeedyG1481 Jan 25 '21 at 15:44
0

You can set resizeToAvoidBottomInset to false in your Scaffold()

Like this:

return Scaffold(
  resizeToAvoidBottomInset: false,
  body: // ...
  // ...
)

Documentation reference: Scaffold - resizeToAvoidBottomInset

Toerktumlare
  • 12,548
  • 3
  • 35
  • 54