簡體   English   中英

Flutter中如何設置appbar中title的高度

[英]How to set the height of the title in the appbar in Flutter

在我的 Flutter 應用程序中,我有一個AppBar ,它的title是一個可點擊的InkWell

我的問題是這個可點擊區域不是應用欄的全高——它只是標題文本高度的一小部分——我希望,為了更令人愉悅的用戶界面,可點擊區域是應用欄的全高應用欄。
(請注意,它不是全寬,我通過將 InkWell 包裹在Padding中來實現)

如何使應用欄中的標題文本具有更高的高度?

(或者以其他方式實現使我的墨水很好地成為 AppBar 的整個高度)

我找到了答案。

不要在AppBar中使用title屬性,而是使用flexibleSpace屬性。

並將您包裹InkWellContainerheight設置為preferredSize.height的值(意思是,獲取 AppBar 本身的高度)。

      AppBar(
          flexibleSpace: Container( 
            padding: EdgeInsets.fromLTRB(100, 0, 100, 0),
            height: preferredSize.height,
            child: InkWell(

暫無
暫無

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

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