draw method

  1. @override
void draw(
  1. Canvas canvas,
  2. Size size,
  3. bool deeper
)
override

绘制核心方法

  • deeper 当前是否为底层绘制
  • 出于性能考虑
  • 绘制过程为表层绘制,绘制完成抬起手指时会进行底层绘制

Implementation

@override
void draw(Canvas canvas, Size size, bool deeper) {
  if (startPoint == null || endPoint == null) {
    return;
  }

  canvas.drawRect(Rect.fromPoints(startPoint!, endPoint!), paint);
}