[英]Flutter - Padding on AppBar
我正在開發的應用程序必須始終處於全屏模式,但是,時間/日期也必須始終顯示,以及某個硬件 ID。 我們找到了以下方式來呈現所述信息:
但是,正如您在上面看到的,我用紅色標記了一個始終位於我的 AppBar 上方的 Padding 小部件,我們希望刪除該填充。 這樣的事情可能嗎?
下面我有我們正在使用的自定義 AppBar 的代碼。
@override
Widget build(BuildContext context) {
return PreferredSize(
preferredSize: Size.fromHeight(45),
child: AppBar(
centerTitle: true,
title: Column(
children: <Widget>[
Text(pageName,
style: TextStyle(
fontSize: pageNameFontSize
),
),
SizedBox(
height: 8,
)
],
),
actions: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
SizedBox(
height: 6,
),
Row(
children: <Widget>[
AppBarClock(
style: TextStyle(
fontSize: 20
),
),
SizedBox(
width: 5,
)
],
),
Row(
children: <Widget>[
Text(this.trailText,
textAlign: TextAlign.right,
),
SizedBox(
width: 5,
)
],
),
],
)
],
),
);
我們正在使用SystemChrome.setEnabledSystemUIOverlays([]); 使應用程序全屏顯示。
那是因為AppBar
自動包含一個SafeArea
每當被視為主要。
只需將它的primary
屬性設置為false
。
AppBar(
primary: false,
...
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.