add custom boxshadow to Flutter card

前端 未结 3 2092
误落风尘
误落风尘 2020-12-29 06:07

I\'ve implemented cards in a Flutter app. I need a custom BoxShadow for every card. How can this be done?

What I\'ve tried so far is to add the Bo

3条回答
  •  滥情空心
    2020-12-29 06:24

    Simply wrap the card in a container for applying shadow to card widget by obtaining boxShadow property.

    new Container(
      width: 100,
      height: 100,
      decoration: new BoxDecoration(
        boxShadow: [
          BoxShadow(
            color: Colors.grey.withOpacity(.5),
            blurRadius: 20.0, // soften the shadow
            spreadRadius: 0.0, //extend the shadow
            offset: Offset(
              5.0, // Move to right 10  horizontally
              5.0, // Move to bottom 10 Vertically
            ),
          )
        ],
      ),
    ),
    

提交回复
热议问题