How can I add shadow to the widget in flutter?

前端 未结 8 1525
余生分开走
余生分开走 2020-12-04 09:07

How can I add shadow to the widget like in the picture below?

This is my current widget code.

8条回答
  •  心在旅途
    2020-12-04 09:34

    this is how I did it

        Container(
      decoration: new BoxDecoration(
        boxShadow: [
          BoxShadow(
            color: Colors.grey[200],
            blurRadius: 2.0, // has the effect of softening the shadow
            spreadRadius: 2.0, // has the effect of extending the shadow
            offset: Offset(
              5.0, // horizontal, move right 10
              5.0, // vertical, move down 10
            ),
          )
        ],
      ),
      child: Container( 
           color: Colors.white, //in your example it's blue, pink etc..
           child: //your content
      )
    

提交回复
热议问题