dart - 我如何在颤动中增加bottomAppbar的高度
问题描述
我的应用程序中有一个 BottomAppBar,但高度似乎只是环绕其中的图标。我想给bottomappbar更多的高度,请问我该怎么做
bottomNavigationBar: BottomAppBar(
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Icon(Icons.category),
Icon(Icons.account_circle),
Icon(Icons.message),
Icon(Icons.access_alarm)
],
),
elevation: 9.0,
shape: CircularNotchedRectangle(),
color: Colors.white,
notchMargin: 8.0,
),
解决方案
您可以为图标添加填充:
BottomAppBar(
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: Icon(Icons.category),
),
Padding(
padding: const EdgeInsets.all(15.0),
child: Icon(Icons.account_circle),
),
Padding(
padding: const EdgeInsets.all(15.0),
child: Icon(Icons.message),
),
Padding(
padding: const EdgeInsets.all(15.0),
child: Icon(Icons.access_alarm),
)
],
),
elevation: 9.0,
shape: CircularNotchedRectangle(),
color: Colors.white,
notchMargin: 8.0,
)
另一个解决方案:我正在使用BottomNavigatorBar
并且它有一个属性iconSize
BottomNavigationBar(
type: BottomNavigationBarType.fixed,
iconSize: 35,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.explore), title: Text('Explore')),
BottomNavigationBarItem(
icon: Icon(Icons.card_travel), title: Text('Adventure')),
BottomNavigationBarItem(
icon: Icon(Icons.search), title: Text('Search')),
BottomNavigationBarItem(
icon: Icon(Icons.collections_bookmark), title: Text('Bookmarks')),
BottomNavigationBarItem(
icon: Icon(Icons.person), title: Text('Profile')),
],
currentIndex: _selectedIndex,
fixedColor: Colors.deepPurple,
onTap: _onItemTapped,
)
推荐阅读
- awk - awk 字典不存储值
- celery - 如何让所有待处理的任务显示在芹菜花任务视图中?
- javascript - React Native 中视图不透明度的类型“IntrinsicAttributes”抛出和错误不存在属性“不透明度”
- html - 如何使用 flexbox 编写 Instagram 探索布局?
- javascript - html中的简单图片覆盖图片
- reactjs - 下一个 js 图片 100% 宽度和比例高度
- google-chrome - 在 URL 中使用 unicode 从 Automator 打开 Chrome 失败
- c# - 如何在运行时创建 C# IEnumerable<"ClassName">?
- java - webelement和driver下面突然有波浪线
- flutter - 使用 Riverpod 从冻结的联合类访问基础数据