How to use both Shadow and Border in CustomPainter Flutter

76 Views Asked by At

is there any way I could add a border to this shadowed paint instance below?

I tried to add a stroke with color but it can't paint both of them at the same time!

Code:

class MyPainter extends CustomPainter {
  final Shadow shadow;
  final CustomClipper<Path> clipper;

  MyPainter({
    required this.shadow,
    required this.clipper,
  });

  @override
  void paint(Canvas canvas, Size size) {
    final paint = shadow.toPaint();
    final path = clipper.getClip(size).shift(shadow.offset);
    canvas.drawPath(path, paint);
  }

  @override
  bool shouldRepaint(MyPainter oldDelegate) => false;

  @override
  bool shouldRebuildSemantics(MyPainter oldDelegate) => false;
}

0

There are 0 best solutions below