I wanted to write about this problem for a long time, but I forgot about it all the time. Recently, I looked through the code and suddenly saw this problem, so I took it out to share my experience with you.
I wrote a page that had a Widget at the bottom, like a “like” or “favorites” Widget for comments, and an input box in the middle of the page. Naturally, when I clicked on the input box, the Widget at the bottom was pushed up by the keyboard. But I don’t want to be jacked up, so what should I do?
resizeToAvoidBottomInset
Copy the code
This property defaults to true, and is set to false to avoid being jacked up by the keyboard, as well as to cause image distortion.
The method of use is:
Widget build(BuildContext context) {
return Scaffold(
/// Avoid the bottom bouncing up
resizeToAvoidBottomInset: false.backgroundColor: Colors.white,
appBar: PreferredSize(
preferredSize: Size.fromHeight(ThemeUI.headerHeight),
child: SafeArea(child: _buildSearchBox()),
),
body: _buildUI());
}
Copy the code