It seems that a recent update of Flutter changed the behavior of the BottomNavigationBar. Formerly, when the keyboard appeared, the keyboard would cover the BottomNavigationBar. Now, however, the BottomNavigationBar sticks to the top of the keyboard when it appears and is always visible.
How do I set the BottomNavigationBar to remain underneath the keyboard when the keyboard appears?
bottomNavigationBar: new BottomNavigationBar(
type: BottomNavigationBarType.fixed,
fixedColor: Colors.blue,
onTap: _navigationTapped,
currentIndex: _pageIndex,
items: [
new BottomNavigationBarItem(icon: new Icon(Icons.apps), title: new Text("Manage")),
new BottomNavigationBarItem(icon: new Icon(Icons.multiline_chart), title: new Text("A")),
new BottomNavigationBarItem(icon: new Icon(Icons.check_box), title: new Text("B")),
new BottomNavigationBarItem(icon: new Icon(Icons.person_add), title: new Text("C")),
new BottomNavigationBarItem(icon: new Icon(Icons.border_color), title: new Text("D")),
]
),
Try removing this: android:windowSoftInputMode="adjustResize" from AndroidManifest. xml This should help. You have 3 options for what to do when the keyboard shows- scroll the app such that the cursor is onscreen, resize the app in the remaining space, or nothing. Number 2 is probably the closest to what you want.
I just came across the same problem where my bottomNavbar is moving up with the keyboard when the keyboard is enabled. I solved it by checking if the keyboard is open or not. If it is open, just hide the disable the bottomNavbar and when it is closed, it's time to enable the navbar..
To create a Menu Resource File , click on the app -> res -> menu(right-click) -> New -> Menu Resource File and name it bottom_nav_menu. Now the user can create as many items as he wants in the bottom_nav_menu. xml file. The user also needs to create an icon for each of these items.
Please make sure the widget tree including the parent only contain one
scaffold.
Scaffold(
body: const TextField(),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
fixedColor: Colors.blue,
onTap: (int value) {
return value;
},
currentIndex: 0,
items: [
BottomNavigationBarItem(icon: new Icon(Icons.apps), title: new Text("Manage")),
BottomNavigationBarItem(icon: new Icon(Icons.multiline_chart), title: new Text("A")),
BottomNavigationBarItem(icon: new Icon(Icons.check_box), title: new Text("B")),
BottomNavigationBarItem(icon: new Icon(Icons.person_add), title: new Text("C")),
BottomNavigationBarItem(icon: new Icon(Icons.border_color), title: new Text("D")),
],
),
);
This will cause bottom navigation being pushed above keyboard.
return Scaffold(
body: Scaffold(
....
if your flutter version is before 1.1.9
use
return Scaffold(
resizeToAvoidBottomPadding: false,
...
else
return Scaffold(
resizeToAvoidBottomInset: false,
...
Do you have resizeToAvoidBottomInset: false
in your Scaffold? That causes the bottomBar to go up when the keyboard appears
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With