如果 AppBar 中的分隔符未显示,可以尝试以下解决方法:
AppBar(
title: Text('My App'),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
// 处理搜索事件
},
),
Divider(), // 分隔符
IconButton(
icon: Icon(Icons.settings),
onPressed: () {
// 处理设置事件
},
),
],
)
AppBar(
toolbarHeight: 80, // 增加 AppBar 高度
title: Text('My App'),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
// 处理搜索事件
},
),
Divider(), // 分隔符
IconButton(
icon: Icon(Icons.settings),
onPressed: () {
// 处理设置事件
},
),
],
)
AppBar(
backgroundColor: Colors.white, // 改变 AppBar 背景色
title: Text('My App'),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
// 处理搜索事件
},
),
Divider(
color: Colors.grey, // 改变分隔符颜色
),
IconButton(
icon: Icon(Icons.settings),
onPressed: () {
// 处理设置事件
},
),
],
)
通过以上方法,你可以解决 AppBar 中分隔符未显示的问题。