Files
buzz/mobile/lib/shared/widgets/lucide_star_icon.dart
klopez4212 aeb741fd31 Polish mobile channel navigation and message sends (#6488)
## Summary
- align iOS back controls and affected titles across channel details,
settings, and pairing
- make channel star and mute actions reflect their state immediately
- animate locally sent channel, thread, and DM messages from behind the
composer with a 300ms ease-out

## Testing
- `just mobile-check`
- full mobile test suite (1,573 tests)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Kenny Lopez <klopez4212@gmail.com>
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
2026-08-21 19:13:16 +01:00

68 lines
1.8 KiB
Dart

import 'dart:math' as math;
import 'package:flutter/material.dart';
/// A Lucide-shaped star that can fill without changing its geometry.
class LucideStarIcon extends StatelessWidget {
/// Creates a Lucide star using [color], optionally filled.
const LucideStarIcon({
super.key,
required this.color,
this.filled = false,
this.size = 22,
});
/// Color of the star's stroke or fill.
final Color color;
/// Whether to paint the star filled instead of outlined.
final bool filled;
/// Width and height of the square icon canvas.
final double size;
@override
Widget build(BuildContext context) => CustomPaint(
size: Size.square(size),
painter: _LucideStarPainter(color: color, filled: filled),
);
}
class _LucideStarPainter extends CustomPainter {
const _LucideStarPainter({required this.color, required this.filled});
final Color color;
final bool filled;
@override
void paint(Canvas canvas, Size size) {
final scale = math.min(size.width, size.height) / 24;
final path = Path()
..moveTo(12 * scale, 2 * scale)
..lineTo(15.09 * scale, 8.26 * scale)
..lineTo(22 * scale, 9.27 * scale)
..lineTo(17 * scale, 14.14 * scale)
..lineTo(18.18 * scale, 21.02 * scale)
..lineTo(12 * scale, 17.77 * scale)
..lineTo(5.82 * scale, 21.02 * scale)
..lineTo(7 * scale, 14.14 * scale)
..lineTo(2 * scale, 9.27 * scale)
..lineTo(8.91 * scale, 8.26 * scale)
..close();
canvas.drawPath(
path,
Paint()
..color = color
..style = filled ? PaintingStyle.fill : PaintingStyle.stroke
..strokeWidth = 2 * scale
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round,
);
}
@override
bool shouldRepaint(_LucideStarPainter oldDelegate) =>
color != oldDelegate.color || filled != oldDelegate.filled;
}