20 lines
481 B
Dart
20 lines
481 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class TrianglePainter extends CustomPainter {
|
|
final Color color;
|
|
TrianglePainter(this.color);
|
|
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
final paint = Paint()..color = color;
|
|
final path = Path()
|
|
..moveTo(0, 0)
|
|
..lineTo(size.width, 0)
|
|
..lineTo(size.width / 2, size.height)
|
|
..close();
|
|
canvas.drawPath(path, paint);
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
|
} |