-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7606384
commit 96fe079
Showing
9 changed files
with
394 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Polygon Painter | ||
class PolygonPainter extends CustomPainter { | ||
final List<Offset> points; | ||
|
||
PolygonPainter(this.points); | ||
|
||
@override | ||
void paint(Canvas canvas, Size size) { | ||
final paint = Paint() | ||
..color = Colors.blue.withOpacity(0.5) | ||
..style = PaintingStyle.fill; | ||
|
||
if (points.isNotEmpty) { | ||
final path = Path()..moveTo(points.first.dx, points.first.dy); | ||
for (final point in points.skip(1)) { | ||
path.lineTo(point.dx, point.dy); | ||
} | ||
path.close(); | ||
canvas.drawPath(path, paint); | ||
} | ||
} | ||
|
||
@override | ||
bool shouldRepaint(covariant CustomPainter oldDelegate) { | ||
return true; | ||
} | ||
} |
Oops, something went wrong.