[英]Removing the drop shadow from a Scaffold AppBar in Flutter?
在 Flutter 中使用 Scaffold 小部件時,有沒有辦法刪除應用欄(AppBar 類)下的投影?
我試過一些可能對你有幫助的東西
AppBar(
backgroundColor: Colors.transparent,
bottomOpacity: 0.0,
elevation: 0.0,
),
看一下這個
如果您想在不重復代碼的情況下刪除所有應用欄的陰影,只需在您的應用程序主題( ThemeData
)中添加一個帶有elevation: 0
的AppBarTheme
屬性,在您的MaterialApp
小部件內:
// This code should be located inside your "MyApp" class, or equivalent (in main.dart by default)
return MaterialApp(
// App Theme:
theme: ThemeData(
// ••• ADD THIS: App Bar Theme: •••
appBarTheme: AppBarTheme(
elevation: 0, // This removes the shadow from all App Bars.
)
),
);
在Flutter中使用Scaffold小部件時,是否可以刪除應用欄(AppBar類)下的陰影?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.