[英]How to remove the small line below Appbar?
Flutter 1.12.13+hotfix.8
Appbar 正下方有一條細線。 你知道如何擺脫它嗎?
代碼:
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.blue,
elevation: 0.0,
actions: <Widget>[
FlatButton(
onPressed: () async {
await _authService.signOut();
},
child: Icon(
Icons.exit_to_app,
color: Colors.white,
),
),
],
),
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
color: Colors.blue),
);
將腳手架 backgroundColor 指定為與您的 AppBar backgroundColor 相同的顏色將解決該問題(在您的情況下為下面的代碼),為應用程序的其余部分提供您想要的顏色,您可以在包含主體的容器的主體顏色中使用該顏色
return Scaffold(
backgroundColor: Colors.blue,//changed background color of scaffold
appBar: AppBar(
backgroundColor: Colors.blue,
elevation: 0.0,
actions: <Widget>[
FlatButton(
onPressed: () async {
await _authService.signOut();
},
child: Icon(
Icons.exit_to_app,
color: Colors.white,
),
),
],
),
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
color: Colors.blue),
);
我在網絡、iphone 模擬器、android 模擬器和我的 android 手機中嘗試了你的代碼,沒有得到白色細線。 我現在正在研究顫振測試版。 也許您的問題可以通過升級顫振或切換頻道來解決。
您可以嘗試將 appbar 的高程屬性設為 0.0
AppBar( 海拔: 0.0, ),
我在 appbar 的高度上添加了 1pt,這條線消失了。
AppBar(
toolbarHeight: kToolbarHeight + 1,
title: Text('Title'),
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.