Files
buzz/mobile/lib/shared/widgets/tabler_star_icon.dart
klopez4212 bbcbd7ce13 Preview Tabler icons in the mobile app (#8109)
## Summary

Preview buzz-app's Tabler icon style in the mobile app, replacing
app-drawn Lucide glyphs across channels, messages, activity, search, and
settings. A shared `BuzzIcons` mapping uses the bundled Tabler 3.46.0
outline font, matching buzz-app's version, with its MIT license and
source documented.

Native UIKit controls retain SF Symbols. The former 300/500 navigation
glyphs use Tabler's standard outline; existing selection colors and
labels remain.

### Related issue

No matching Tabler mobile migration issue or PR found. Related native
iOS controls: #8055.

### Testing

- Pre-push mobile analysis, formatting, file-size checks, and the full
mobile test suite passed.
- 194 focused widget tests passed, including channels, home, search,
settings, and message content.
- Light and dark community-settings renders inspected.
- Signed iPhone Release build succeeded; installed and launched as Buzz
Tabler on a physical iPhone.
- Full `just ci` attempted; stopped during Rust clippy compilation
because the Mac ran low on disk space. Full repository validation is not
claimed.

Signed-off-by: kenny lopez <klopez4212@gmail.com>
2026-10-08 10:40:12 -04:00

70 lines
2.1 KiB
Dart

import 'dart:math' as math;
import 'package:flutter/material.dart';
/// A Tabler-shaped star that can fill without changing its geometry.
class TablerStarIcon extends StatelessWidget {
/// Creates a Tabler star using [color], optionally filled.
const TablerStarIcon({
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: _TablerStarPainter(color: color, filled: filled),
);
}
class _TablerStarPainter extends CustomPainter {
const _TablerStarPainter({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;
// Tabler 3.46.0 outline/star.svg, shared by both Star action surfaces.
final path = Path()
..moveTo(12 * scale, 17.75 * scale)
..relativeLineTo(-6.172 * scale, 3.245 * scale)
..relativeLineTo(1.179 * scale, -6.873 * scale)
..relativeLineTo(-5 * scale, -4.867 * scale)
..relativeLineTo(6.9 * scale, -1 * scale)
..relativeLineTo(3.086 * scale, -6.253 * scale)
..relativeLineTo(3.086 * scale, 6.253 * scale)
..relativeLineTo(6.9 * scale, 1 * scale)
..relativeLineTo(-5 * scale, 4.867 * scale)
..relativeLineTo(1.179 * scale, 6.873 * scale)
..relativeLineTo(-6.158 * scale, -3.245 * 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(_TablerStarPainter oldDelegate) =>
color != oldDelegate.color || filled != oldDelegate.filled;
}