簡體   English   中英

如何從一側移除高程陰影而不從卡片或材料小部件中移除高程本身?

[英]How to remove elevation shadow from one side without removing elevation itself in flutter from Card or Material widget?

如何刪除 Card 或 Material 小部件內的頂部高程陰影。

我將 Material 小部件用於容器並給出了高程值。 它從四面八方反射到我的容器。 但我只想要左側、底部和右側的高度陰影。 我怎樣才能得到它或去除頂側立面陰影。 來自 Material 或 Card Widget 的示例會很有用。

Material(
  elevation: 3,
  child: Container(
    height: 100,
    width: 300,
  ),
)

示例圖片

為此,您只需要通過增加offset屬性的y 軸來降低shadow ,就像這樣:

Container(
  height: 100.0,
  width: 300.0,
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(20.0),
      color: Colors.white,
      boxShadow: [
        BoxShadow(
          spreadRadius: 2,
          blurRadius: 3,
          offset: Offset(0, 6),
          color: Colors.black38
        )
      ]
    ),
  ),

這是輸出:

在此處輸入圖片說明

暫無
暫無

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

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