chr*_*788 14 flutter flutter-layout
最近 Flutter 的更新似乎改变了 BottomNavigationBar 的行为。以前,当键盘出现时,键盘会覆盖BottomNavigationBar。但是,现在,BottomNavigationBar 出现时会粘在键盘的顶部并且始终可见。
当键盘出现时,如何将BottomNavigationBar 设置为保留在键盘下方?
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")),
]
),
Run Code Online (Sandbox Code Playgroud)
Ter*_*rry 14
请确保包括父级的小部件树仅包含one脚手架。
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")),
],
),
);
Run Code Online (Sandbox Code Playgroud)
这将导致底部导航被推到键盘上方。
return Scaffold(
body: Scaffold(
....
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5010 次 |
| 最近记录: |