edge_painter.dart 533 B

12345678910111213141516171819202122232425
  1. import 'dart:ui';
  2. import 'package:flutter/material.dart';
  3. class EdgePainter extends CustomPainter {
  4. EdgePainter({required this.points, required this.color});
  5. final List<Offset> points;
  6. final Color color;
  7. @override
  8. void paint(Canvas canvas, Size size) {
  9. final paint = Paint()
  10. ..color = color.withOpacity(0.5)
  11. ..strokeWidth = 2
  12. ..strokeCap = StrokeCap.round;
  13. canvas.drawPoints(PointMode.polygon, points, paint);
  14. }
  15. @override
  16. bool shouldRepaint(CustomPainter old) {
  17. return true;
  18. }
  19. }