paint method

  1. @override
void paint(
  1. Canvas canvas,
  2. Size size,
  3. ExtendedImageCropLayerPainter painter,
  4. Rect rect,
)

Paint the entire crop layer, including mask, lines, and corners The rect may be bigger than size, when we roate crop rect. Adjust the rect to ensure the mask covers the whole area after rotation

Implementation

@override
void paint(Canvas canvas, Size size, ExtendedImageCropLayerPainter painter, Rect rect) {
  paintMask(canvas, rect, painter);
  //定义画笔
  Paint paint = Paint()
    ..color = Colors.grey
    ..strokeCap = StrokeCap.square
    ..isAntiAlias = true
    ..strokeWidth = 3.0
    ..style = PaintingStyle
        .stroke; //画笔样式有填充PaintingStyle.fill 及没有填充PaintingStyle.stroke 两种

  canvas.drawCircle(const Offset(200.0, 150.0), 150.0, paint);
}