我正在使用Flutter应用程序,并在Appbar中看到了一个问题。 图标按钮不在应用栏的中央。
这是我的代码
appBar: AppBar(
automaticallyImplyLeading: false,
actions: <Widget>[
IconButton(
icon: Icon(Icons.home),
onPressed: null,
),
IconButton(
icon: Icon(Icons.trending_up),
onPressed: null,
),
IconButton(
icon: Icon(Icons.people_outline),
onPressed: null,
),
IconButton(
icon: Icon(Icons.person_outline),
onPressed: null,
),
IconButton(
icon: Icon(Icons.notifications_none),
onPressed: null,
),
IconButton(
icon: Icon(Icons.search),
onPressed: null
),
IconButton(
icon: Icon(Icons.brightness_5),
onPressed: null,
),
],
),
先谢谢了:)
答案 0 :(得分:1)
这是解决该问题的一种方法,因为操作通常在标题之后出现,如文档所说的AppBar class。
appBar: AppBar(
automaticallyImplyLeading: false,
centerTitle: true,
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(Icons.home),
onPressed: null,
),
IconButton(
icon: Icon(Icons.trending_up),
onPressed: null,
),
IconButton(
icon: Icon(Icons.people_outline),
onPressed: null,
),
IconButton(
icon: Icon(Icons.person_outline),
onPressed: null,
),
IconButton(
icon: Icon(Icons.notifications_none),
onPressed: null,
),
IconButton(icon: Icon(Icons.search), onPressed: null),
IconButton(
icon: Icon(Icons.brightness_5),
onPressed: null,
),
],
)),
但是也许您应该考虑在您的情况下使用TabBar。