import 'package:flutter/material.dart'; /// Icône du cœur HEMS (« Héos ») : étincelle de marque au centre, /// 4 nœuds pilotés alignés sur les pointes. class HemsIcon extends StatelessWidget { final double size; final Color? color; const HemsIcon({super.key, this.size = 24, this.color}); @override Widget build(BuildContext context) { final c = color ?? IconTheme.of(context).color ?? const Color(0xFF28A06A); return SizedBox( width: size, height: size, child: CustomPaint(painter: _HemsPainter(c)), ); } } class _HemsPainter extends CustomPainter { final Color color; _HemsPainter(this.color); static const _nodes = [ Offset(12, 3.4), Offset(20.6, 12), Offset(12, 20.6), Offset(3.4, 12), ]; static const _nodeR = 1.7; @override void paint(Canvas canvas, Size size) { final s = size.width / 24.0; final paint = Paint() ..color = color ..style = PaintingStyle.fill ..isAntiAlias = true; final spark = Path() ..moveTo(12 * s, 7.4 * s) ..lineTo(13.25 * s, 10.75 * s) ..lineTo(16.6 * s, 12 * s) ..lineTo(13.25 * s, 13.25 * s) ..lineTo(12 * s, 16.6 * s) ..lineTo(10.75 * s, 13.25 * s) ..lineTo(7.4 * s, 12 * s) ..lineTo(10.75 * s, 10.75 * s) ..close(); canvas.drawPath(spark, paint); for (final n in _nodes) { canvas.drawCircle(Offset(n.dx * s, n.dy * s), _nodeR * s, paint); } } @override bool shouldRepaint(_HemsPainter old) => old.color != color; }