Issue
In Flutter, how to make FAB button hide when onscreen keyboard appear?
FAB button cover up other element when on screenkeyboard show up.
Solution
Wrap your FloatingActionButton with a Visibility widget and control the visibility with a bool value.
Widget build(context) {
bool keyboardIsOpen = MediaQuery.of(context).viewInsets.bottom != 0;
return Scaffold(
body: // ...
floatingActionButton: Visibility(
visible: !keyboardIsOpen,
child: // your FloatingActionButton
),
);
}
This solution also gets rid of the animation when the button disappears and appears.
Be sure that the class extends StatefulWidget and you have created a state for it
Answered By - stereo

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.