import 'package:flutter/material.dart'; class CoopIcon extends StatelessWidget { final double size; final Color? color; const CoopIcon({super.key, this.size = 24, this.color}); @override Widget build(BuildContext context) { final iconColor = color ?? Theme.of(context).colorScheme.primary; return SizedBox( width: size, height: size, child: CustomPaint( painter: _CoopPainter(iconColor), ), ); } } class _CoopPainter extends CustomPainter { final Color color; _CoopPainter(this.color); @override void paint(Canvas canvas, Size size) { final paint = Paint() ..color = color ..style = PaintingStyle.stroke ..strokeWidth = size.width / 12 ..strokeCap = StrokeCap.round ..strokeJoin = StrokeJoin.round; final w = size.width; final h = size.height; final path = Path(); // Main structure path.moveTo(w * 0.2, h * 0.85); path.lineTo(w * 0.8, h * 0.85); path.lineTo(w * 0.8, h * 0.4); path.lineTo(w * 0.2, h * 0.4); path.close(); // Roof path.moveTo(w * 0.1, h * 0.4); path.lineTo(w * 0.5, h * 0.1); path.lineTo(w * 0.9, h * 0.4); // Legs path.moveTo(w * 0.3, h * 0.85); path.lineTo(w * 0.3, h * 1.0); path.moveTo(w * 0.7, h * 0.85); path.lineTo(w * 0.7, h * 1.0); // Window/Mesh path.addRect(Rect.fromLTWH(w * 0.4, h * 0.55, w * 0.2, h * 0.2)); canvas.drawPath(path, paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }