簡體   English   中英

Flutter 將應用欄標題向左偏移

[英]Flutter offset the appbar title to the left

我正在為我的應用程序創建頁面,並創建了帶有前導圖標的應用欄。 然而,圖標和標題之間的空間非常大,對我來說,看起來很遠。

我確實將應用欄的標題向左偏移/推一點。

代碼:

appBar: AppBar(
    leading: Builder(
        builder: (BuildContext context) {
        return IconButton(
            icon: const Icon(Icons.chevron_left),
            iconSize: MediaQuery.of(context).size.width * 0.1,
            splashColor: Colors.transparent,
            highlightColor: Colors.transparent,
            padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
            onPressed: () => Navigator.of(context).pop(),
        );
        },
    ),
    title: Text("Student Finance",
        style: TextStyle(color: Colors.white),
    ),
),

截屏:

在此處輸入圖片說明

// 添加標題小部件下的所有內容並設置為 false

AppBar(
    title: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[  
            IconButton(
                onPressed: () => Navigator.pop(context),
                icon: const Icon(Icons.chevron_left, size: 32.0),
            ),
            Text("Student Finance"),
        ],
    ),
    titleSpacing: 0.0,
    automaticallyImplyLeading: false,
),

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM