Can I draw a custom box shadow in Flutter using Canvas in a CustomPaint?

前端 未结 2 705
迷失自我
迷失自我 2021-02-08 06:46

It\'s clear how to draw a shadow with an elevation property but what if I want to have the shadow centered for example?

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 07:41

    To draw shadow on CustomPaint you can use painter.

    CustomPaint(
      painter: BoxShadowPainter(),
      child: ClipPath(
      clipper: MyClipper(), //my CustomClipper
      child: Container(), // my widgets inside
    )));
    

    check my answer here

提交回复
热议问题