Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

dart - Flutter keyboard resize problem on Real Phone

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?

question from:https://stackoverflow.com/questions/65887615/flutter-keyboard-resize-problem-on-real-phone

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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()
  );
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...