如何在不从 Card 或 Material 小部件中移除高程本身的情况下从一侧移除高程阴影?

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

如何删除卡片或 Material 小部件中的顶部高程阴影。

我将 Material 小部件用于容器,并给出了高度值。它全方位地反映到我的容器中。但我只想要左侧、底部和右侧的高程阴影。我怎样才能得到它或删除顶部高程阴影。 来自 Material 或 Card Widget 的示例将很有用。

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

为此,您只需通过增加 offset y-axis 来稍微降低 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
        )
      ]
    ),
  ),

这是输出: