LCOV - code coverage report
Current view: top level - components/tabs - foss_tabs_visuals.dart Coverage Total Hit
Test: fossui coverage Lines: 100.0 % 19 19
Test Date: 2026-11-29 09:15:47 Functions: - 0 0

            Line data    Source code
       1              : part of 'foss_tabs.dart';
       2              : 
       3              : /// Builds the default appearance from the theme tokens for [variant], then lays
       4              : /// a per-instance [override] over it field by field.
       5            1 : _TabsVisuals _resolve(
       6              :   FossThemeData theme,
       7              :   FossTabsVariant variant,
       8              :   bool dark,
       9              :   FossTabsStyle? override,
      10              : ) {
      11            1 :   final c = theme.colors;
      12            1 :   final segmented = variant == FossTabsVariant.segmented;
      13            1 :   return _TabsVisuals(
      14            2 :     barColor: override?.barColor ?? c.muted,
      15              :     indicatorColor:
      16            1 :         override?.indicatorColor ??
      17            3 :         (segmented ? (dark ? c.input : c.background) : c.primary),
      18              :     indicatorShadow:
      19            1 :         override?.indicatorShadow ??
      20            3 :         (segmented ? _pillShadow(theme.shadows.sm) : const <BoxShadow>[]),
      21            2 :     hoverColor: override?.hoverColor ?? c.accent,
      22            2 :     activeForeground: override?.activeForeground ?? c.foreground,
      23            2 :     inactiveForeground: override?.inactiveForeground ?? c.mutedForeground,
      24            4 :     labelStyle: override?.labelStyle ?? theme.typography.base.medium,
      25            2 :     barRadius: theme.radii.lg,
      26            2 :     tabRadius: theme.radii.md,
      27              :   );
      28              : }
      29              : 
      30              : // The elevated pill wears a faint lift, the small shadow softened to a 5% tint
      31              : // so it reads as a whisper of elevation, not a drop shadow.
      32            2 : List<BoxShadow> _pillShadow(List<BoxShadow> base) => <BoxShadow>[
      33            1 :   for (final shadow in base)
      34            3 :     shadow.copyWith(color: shadow.color.withValues(alpha: 0.05)),
      35              : ];
      36              : 
      37              : /// The fully resolved, non-null appearance. A [FossTabsStyle] override is laid
      38              : /// over it by [_resolve], so the widget reads only non-null fields.
      39              : @immutable
      40              : class _TabsVisuals {
      41            1 :   const _TabsVisuals({
      42              :     required this.barColor,
      43              :     required this.indicatorColor,
      44              :     required this.indicatorShadow,
      45              :     required this.hoverColor,
      46              :     required this.activeForeground,
      47              :     required this.inactiveForeground,
      48              :     required this.labelStyle,
      49              :     required this.barRadius,
      50              :     required this.tabRadius,
      51              :   });
      52              : 
      53              :   final Color barColor;
      54              :   final Color indicatorColor;
      55              :   final List<BoxShadow> indicatorShadow;
      56              :   final Color hoverColor;
      57              :   final Color activeForeground;
      58              :   final Color inactiveForeground;
      59              :   final TextStyle labelStyle;
      60              :   final double barRadius;
      61              :   final double tabRadius;
      62              : }
        

Generated by: LCOV version 2.0-1