如何用Card这样的阴影?

时间:2018-11-17 03:07:08

标签: flutter

这就是我想要成为的结果

enter image description here

2 个答案:

答案 0 :(得分:3)

制作自定义卡

response:\n
     {"code":"BadRequest","message":"Invalid request","innerError": 
     {"code":"InvalidRequestBodyFormat","message":"Request body 
     (truncated...)\n

您需要的是Box Shadow。我希望这会有所帮助。

答案 1 :(得分:0)

我知道用阴影制作卡片的两种方法。一个内置Card Widget,另一个使用Container Widget

1。使用卡片小工具

SizedBox.expand(
          child: Card(
            margin: EdgeInsets.all(10),
            elevation: 3.0,// this field changes the shadow of the card 1.0 is default
            shape: RoundedRectangleBorder(
                side: BorderSide(width: 0.2),
                borderRadius: BorderRadius.circular(20)),
          ),
        )

enter image description here

  1. 使用容器小部件
 Container(
           margin: EdgeInsets.all(10),
           decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20),
              border: Border.all(width: 0.2),
              boxShadow: [
                BoxShadow(
                    blurRadius: 2.0,
                    spreadRadius: 0.4,
                    offset: Offset(0.1, 0.5)),
              ],
              color: Colors.white),
              )

修改BlurRadius和offset以更改容器的阴影

enter image description here

相关问题