flutter - 颤振:库比蒂诺标签栏
问题描述
如何使 Cupertino TabBar 以与 BottomNavigationBar 相同的方式工作?
底部导航栏
return Scaffold(
bottomNavigationBar: _bottomNavigationBar(_selectedIndex),
body: PageStorage(
child: pages[_selectedIndex],
bucket: bucket,
库比蒂诺标签栏
final PageStorageBucket bucket = PageStorageBucket();
int _selectedIndex = 1;
Widget _tabBar(int selectedIndex) => CupertinoTabBar(
onTap: (int index) => setState(() => _selectedIndex = index),
currentIndex: selectedIndex,
backgroundColor: Color(0xffffffff),
iconSize: 20,
items: ...
@override
Widget build(BuildContext context) {
return CupertinoTabScaffold(
tabBuilder: _tabBar(_selectedIndex),
child: PageStorage(
child: pages[_selectedIndex],
bucket: bucket,
解决方案
推荐阅读
- android - Android 安装其他应用程序的权限
- visual-studio-code - 在 VScode 中使用 GDB 将 watch 变量的格式设置为十六进制
- c++ - C ++中网络之间的套接字
- spring - 在春季批处理写入器中写入多个不相关的表
- android - Flutter 社交分享插件(facebook / instagram)不起作用
- ruby-on-rails - 使用未确认的帐户登录时,覆盖设计会话控制器以触发“确认您的电子邮件”电子邮件
- c - 如何在不影响性能的情况下实现原始类型的类型安全?
- reactjs - 制作 Service Worker 后,我的网站仅在我删除缓存时加载
- android - 如何在android的firebase recyclerview中播放和暂停音频
- angular - Angular 中的 @SkipSelf 装饰器是什么?