I was having bottom overflow issue (this is so funny) when keyboard is shown, so I set my scaffold
resizeToAvoidBottomInset
property to false
as suggested in a few SO posts.
Doing this fixes the overflow issue but has an unintended consequence where snackbar
appears below the keyboard and is thus invisible.
Setting resizeToAvoidBottomInset
to true
solves the snackbar
issue, but the bottom overflow is back!
How can I have my cake and eat it too?
Thanks for SingleChildScrollView
solution, Copilot suggested that one too.
I ended up using a different approach, sharing here in case anyone else finds it useful.
On performing the action I close the keyboard. This way the results will be visible without keyboard obstructing the view, and if there are any error, snackbar
will be visible too. I preferred this over scroll view approach.
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
_doSomething();
// Hide the keyboard
FocusScope.of(context).unfocus();
},
),