import 'package:flutter/material.dart'; import 'package:flyinsonolite/infrastructure/scale.dart'; class DiagonalPainter extends CustomPainter { final Color color; DiagonalPainter(this.color); @override void paint(Canvas canvas, Size size) { final paint = Paint() ..color = color ..style = PaintingStyle.fill ..strokeWidth = 2.s; final path = Path() ..moveTo(0, 0) ..lineTo(64.s, 64.s) ..lineTo(64.s, 8.s) ..quadraticBezierTo(64.s, 0, 56.s, 0) ..lineTo(0, 0) ..close(); canvas.drawPath(path, paint); } @override bool shouldRepaint(covariant DiagonalPainter oldDelegate) { ///此处可以设置颜色动态值 return oldDelegate.color != color; } }