79429696

Date: 2025-02-11 10:53:58
Score: 1
Natty:
Report link

When using the Builder widget, the parent's build method will construct a new tree of widgets so a new Builder child will not be identified the outside context of the keyboard --> do not know the keyboard change event --> height keyboard always returns 0.

Try to calculate availableHeight out of Builder widget:

Widget build(BuildContext context) { 
double screenHeight = MediaQuery.sizeOf(context).height; 
double keyboardHeight = MediaQuery.viewInsetsOf(context).bottom; 
...

And use MediaQuery.viewInsetsOf instead, this is new recommend docs.

P/S: This [video](https://youtu.be/ceCo8U0XHqw?si=yAyRxzUt6c_L2vnC show clearly the concept of viewInsets,viewPadding and padding

Reasons:
  • Blacklisted phrase (1): youtu.be
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: N.LanLuu