![](/img/trans.png)
[英]How to remove elevation shadow from one side without removing elevation itself in flutter from Card or Material widget?
[英]How to remove the elevation (shadow) in a SearchDelegate?
在 Searchdelegate 類中添加:
@override
ThemeData appBarTheme(BuildContext context){
assert(context != null);
final ThemeData theme = Theme.of(context);
assert(theme != null);
return theme.copyWith(
primaryColor: Colors.grey[50],
);
}
這是主要的應用程序主題:
MaterialApp(
theme: ThemeData(
backgroundColor: Colors.white,
appBarTheme: AppBarTheme(elevation: 0.0), //This is important
title: 'Flutter Demo',
home: MyHomePage(),
);
在您的ThemeData()
相應的更改並添加appBarTheme: AppBarTheme(elevation: 0.0),
以刪除高程和 SearchDelegate 主題,因為它是您的搜索委托類,它將確保您的材料應用程序的 ThemeData 中定義的高程是實施的。
注意:我猜,ThemeData 中設置的高度也會影響整個應用程序其他頁面中應用欄的高度。
結果:輸出圖像
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.