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

            Line data    Source code
       1              : part of 'foss_menu.dart';
       2              : 
       3              : /// Builds the default appearance from the theme tokens, then lays a
       4              : /// per-instance [override] over it field by field.
       5            4 : _MenuVisuals _resolve(FossThemeData theme, FossMenuStyle? override) {
       6            4 :   final c = theme.colors;
       7            8 :   final rowStyle = theme.typography.base;
       8            4 :   return _MenuVisuals(
       9            1 :     minWidth: override?.minWidth ?? _minPanelWidth,
      10            5 :     backgroundColor: override?.backgroundColor ?? c.popover,
      11            5 :     borderColor: override?.borderColor ?? c.border,
      12            9 :     borderRadius: override?.borderRadius ?? theme.radii.lg,
      13           13 :     padding: override?.padding ?? EdgeInsets.all(theme.spacing(1)),
      14            8 :     rowPadding: theme.spacing(2),
      15            8 :     rowPaddingY: theme.spacing(1),
      16            8 :     labelPaddingY: theme.spacing(1.5),
      17            8 :     gap: theme.spacing(2),
      18            9 :     rowRadius: override?.rowRadius ?? theme.radii.sm,
      19            5 :     highlightColor: override?.highlightColor ?? c.accent,
      20            5 :     highlightForeground: override?.highlightForeground ?? c.accentForeground,
      21            5 :     foreground: override?.foreground ?? c.popoverForeground,
      22            4 :     destructiveForeground: c.destructiveForeground,
      23            4 :     separatorColor: c.border,
      24            1 :     iconSize: override?.iconSize ?? _iconSize,
      25            5 :     textStyle: rowStyle.merge(override?.textStyle),
      26           16 :     shortcutStyle: theme.typography.xs.medium.copyWith(
      27            8 :       color: c.mutedForeground.withValues(
      28           12 :         alpha: c.mutedForeground.a * _shortcutOpacity,
      29              :       ),
      30              :     ),
      31           20 :     labelStyle: theme.typography.xs.medium.copyWith(color: c.mutedForeground),
      32           12 :     shadows: overlaySoftShadow(theme.shadows.lg),
      33              :   );
      34              : }
      35              : 
      36              : /// The fully resolved, non-null appearance of one menu. A [FossMenuStyle]
      37              : /// override is laid over it by [_resolve], so the widget reads only non-null
      38              : /// fields.
      39              : @immutable
      40              : class _MenuVisuals {
      41            4 :   const _MenuVisuals({
      42              :     required this.minWidth,
      43              :     required this.backgroundColor,
      44              :     required this.borderColor,
      45              :     required this.borderRadius,
      46              :     required this.padding,
      47              :     required this.rowPadding,
      48              :     required this.rowPaddingY,
      49              :     required this.labelPaddingY,
      50              :     required this.gap,
      51              :     required this.rowRadius,
      52              :     required this.highlightColor,
      53              :     required this.highlightForeground,
      54              :     required this.foreground,
      55              :     required this.destructiveForeground,
      56              :     required this.separatorColor,
      57              :     required this.iconSize,
      58              :     required this.textStyle,
      59              :     required this.shortcutStyle,
      60              :     required this.labelStyle,
      61              :     required this.shadows,
      62              :   });
      63              : 
      64              :   final double minWidth;
      65              :   final Color backgroundColor;
      66              :   final Color borderColor;
      67              :   final double borderRadius;
      68              :   final EdgeInsetsGeometry padding;
      69              : 
      70              :   /// Horizontal inset inside a row, and the separator's side margin.
      71              :   final double rowPadding;
      72              : 
      73              :   /// Vertical inset inside an action row, and the separator's top and bottom
      74              :   /// margin.
      75              :   final double rowPaddingY;
      76              : 
      77              :   /// Vertical inset inside a group heading, which sits taller than an action
      78              :   /// row's.
      79              :   final double labelPaddingY;
      80              : 
      81              :   /// Gap between a row's glyph, its text, and its shortcut.
      82              :   final double gap;
      83              : 
      84              :   final double rowRadius;
      85              :   final Color highlightColor;
      86              :   final Color highlightForeground;
      87              :   final Color foreground;
      88              :   final Color destructiveForeground;
      89              :   final Color separatorColor;
      90              :   final double iconSize;
      91              :   final TextStyle textStyle;
      92              :   final TextStyle shortcutStyle;
      93              :   final TextStyle labelStyle;
      94              :   final List<BoxShadow> shadows;
      95              : 
      96              :   /// The text and glyph color of an action row, which the highlight and the
      97              :   /// destructive flag both move.
      98            4 :   Color rowColor({required bool highlighted, required bool destructive}) {
      99            1 :     if (destructive) return destructiveForeground;
     100            6 :     return highlighted ? highlightForeground : foreground;
     101              :   }
     102              : }
        

Generated by: LCOV version 2.0-1