[英]How to center the IconButton of Appbar in flutter
我使用顫振應用程序並在應用欄中看到一個問題。 圖標按鈕不在應用欄的中心。
這是我的代碼。
appBar: AppBar(
automaticallyImplyLeading: false,
actions: <Widget>[
IconButton(
icon: Icon(Icons.home),
onPressed: null,
)
],
),
IconButton 不在應用欄或導航欄的中心。
這是您可以采取的一種解決方法來實現這一點,因為操作通常在標題之后,如文檔所述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。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.