Last active
April 27, 2024 14:02
-
-
Save kururu-abdo/0ca232c8373196add5e2db48fe62afdb to your computer and use it in GitHub Desktop.
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
@override | |
Path getClip(Size size) { | |
double radius = 50; | |
Path path = Path() | |
..lineTo(size.width - radius, 0) | |
..arcTo( | |
Rect.fromPoints( | |
Offset(size.width - radius, 0), Offset(size.width, radius)), // Rect | |
1.5 * pi, // Start engle | |
0.5 * pi, // Sweep engle | |
true) // direction clockwise | |
..lineTo(size.width, size.height - radius) | |
..arcTo(Rect.fromCircle(center: Offset(size.width - radius, size.height - radius), radius: radius), 0, 0.5 * pi, false) | |
..lineTo(radius, size.height) | |
..arcTo(Rect.fromLTRB(0, size.height - radius, radius, size.height), 0.5 * pi, 0.5 * pi, false) | |
..lineTo(0, radius) | |
..arcTo(Rect.fromLTWH(0, 0, 70, 100), 1 * pi, 0.5 * pi, false) | |
..close(); | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`class TrianglePainter extends CustomPainter {
final Color strokeColor;
final PaintingStyle paintingStyle;
final double strokeWidth;
TrianglePainter(
{this.strokeColor = Colors.black,
this.strokeWidth = 3,
this.paintingStyle = PaintingStyle.stroke});
@OverRide
void paint(Canvas canvas, Size size) {
Paint paint = Paint()
..color = strokeColor
..strokeWidth = strokeWidth
..style = paintingStyle;
}
Path getTrianglePath(double x, double y) {
return Path()
..moveTo(0, y)
..lineTo(x / 2, 0)
..lineTo(x, y)
..lineTo(0, y);
}
@OverRide
bool shouldRepaint(TrianglePainter oldDelegate) {
return oldDelegate.strokeColor != strokeColor ||
oldDelegate.paintingStyle != paintingStyle ||
oldDelegate.strokeWidth != strokeWidth;
}
}`