rectangle.dart 641 B

1234567891011121314151617181920212223242526272829303132
  1. import 'package:fis_measure/view/paint/parts/index.dart';
  2. import 'package:flutter/material.dart';
  3. /// ai矩形
  4. class PaintAIRectangle extends CustomPainter {
  5. final double left;
  6. final double top;
  7. final double width;
  8. final double height;
  9. PaintAIRectangle(
  10. this.left,
  11. this.top,
  12. this.width,
  13. this.height,
  14. );
  15. @override
  16. void paint(Canvas canvas, Size size) {
  17. Rect rect = Rect.fromLTWH(
  18. left,
  19. top,
  20. width,
  21. height,
  22. );
  23. canvas.drawRect(rect, aiPaint);
  24. }
  25. @override
  26. bool shouldRepaint(covariant PaintAIRectangle oldDelegate) {
  27. return oldDelegate.hashCode != hashCode;
  28. }
  29. }