Line data Source code
1 : part of 'foss_bottom_nav_bar.dart';
2 :
3 : // The glyph is the primary target on a phone, a step up from the 18 a tab strip
4 : // carries.
5 : const double _iconSize = 24;
6 : const double _ringWidth = 2;
7 :
8 : /// Builds the default appearance from the theme tokens, then lays a
9 : /// per-instance [override] over it field by field.
10 1 : _NavVisuals _resolve(FossThemeData theme, FossBottomNavBarStyle? override) {
11 1 : final c = theme.colors;
12 1 : return _NavVisuals(
13 2 : backgroundColor: override?.backgroundColor ?? c.background,
14 2 : borderColor: override?.borderColor ?? c.border,
15 2 : selectedColor: override?.selectedColor ?? c.foreground,
16 2 : unselectedColor: override?.unselectedColor ?? c.mutedForeground,
17 4 : labelStyle: override?.labelStyle ?? theme.typography.xs.medium,
18 1 : iconSize: override?.iconSize ?? _iconSize,
19 1 : minHeight: override?.minHeight ?? _minCellHeight,
20 1 : showTopBorder: override?.showTopBorder ?? true,
21 1 : ringColor: c.ring,
22 2 : ringRadius: theme.radii.md,
23 : );
24 : }
25 :
26 : /// The fully resolved, non-null appearance. A [FossBottomNavBarStyle] override
27 : /// is laid over it by [_resolve], so the widget reads only non-null fields.
28 : /// The focus ring stays token-driven and is not overridable per instance.
29 : @immutable
30 : class _NavVisuals {
31 1 : const _NavVisuals({
32 : required this.backgroundColor,
33 : required this.borderColor,
34 : required this.selectedColor,
35 : required this.unselectedColor,
36 : required this.labelStyle,
37 : required this.iconSize,
38 : required this.minHeight,
39 : required this.showTopBorder,
40 : required this.ringColor,
41 : required this.ringRadius,
42 : });
43 :
44 : final Color backgroundColor;
45 : final Color borderColor;
46 : final Color selectedColor;
47 : final Color unselectedColor;
48 : final TextStyle labelStyle;
49 : final double iconSize;
50 : final double minHeight;
51 : final bool showTopBorder;
52 : final Color ringColor;
53 : final double ringRadius;
54 : }
|