Refactor badge handling across components to use m3e colors, remove unused _SmallDot widget, and clean up redundant code.

This commit is contained in:
Emily Pauli 2025-10-23 14:45:16 +02:00
commit 05c489991a
6 changed files with 21 additions and 32 deletions

View file

@ -135,7 +135,6 @@ class _NavigationRailM3EState extends State<NavigationRailM3E>
void _insertOverlay() {
final overlay = Overlay.of(context, rootOverlay: true);
if (overlay == null) return;
_modalEntry = OverlayEntry(builder: (ctx) => _buildModalOverlay(ctx));
overlay.insert(_modalEntry!);
}
@ -147,7 +146,6 @@ class _NavigationRailM3EState extends State<NavigationRailM3E>
void _insertCollapsedPeekOverlay() {
final overlay = Overlay.of(context, rootOverlay: true);
if (overlay == null) return;
_collapsedPeekEntry =
OverlayEntry(builder: (ctx) => _buildCollapsedPeekOverlay(ctx));
overlay.insert(_collapsedPeekEntry!);

View file

@ -65,19 +65,3 @@ class RailBadgeM3E extends StatelessWidget {
return v;
}
}
class _SmallDot extends StatelessWidget {
const _SmallDot({required this.color});
final Color color;
@override
Widget build(BuildContext context) {
return Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
),
);
}
}

View file

@ -36,11 +36,9 @@ class NavigationRailTokensAdapter {
}
Color get badgeBackground =>
_maybe(() => context.m3e.colors.error) ?? _cs.error;
_maybe(() => context.m3e.colors.primary) ?? _cs.primary;
Color get badgeLargeLabel =>
_maybe(() => context.m3e.colors.onError) ?? _cs.onError;
Color get badgeSmallDot =>
_maybe(() => context.m3e.colors.error) ?? _cs.error;
_maybe(() => context.m3e.colors.onPrimary) ?? _cs.onPrimary;
ShapeBorder get indicatorShapeFull {
// Full corner per M3E: use the most rounded token, fallback to StadiumBorder.