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

            Line data    Source code
       1              : part of 'foss_select.dart';
       2              : 
       3              : /// Visual overrides for a single [FossSelect] or [FossMultiSelect]. Every field
       4              : /// is optional; a null field falls back to the value the theme resolves. Pass
       5              : /// one via `style:` to tweak a one-off without changing the theme for every
       6              : /// other select.
       7              : ///
       8              : /// The overrides cover the trigger surface. State-derived colors (the focus
       9              : /// ring and invalid border), the popup surface, and the row highlight stay
      10              : /// token-driven; to restyle those globally, retheme `FossColors`.
      11              : ///
      12              : /// A taller trigger with a custom resting fill:
      13              : ///
      14              : /// ```dart
      15              : /// FossSelect<String>(
      16              : ///   value: plan,
      17              : ///   items: items,
      18              : ///   style: const FossSelectStyle(
      19              : ///     minHeight: 44,
      20              : ///     backgroundColor: Color(0xFFF7F7F7),
      21              : ///   ),
      22              : /// );
      23              : /// ```
      24              : @immutable
      25              : class FossSelectStyle {
      26              :   /// Creates a set of select overrides. All fields default to null (inherit).
      27            1 :   const FossSelectStyle({
      28              :     this.backgroundColor,
      29              :     this.foregroundColor,
      30              :     this.placeholderColor,
      31              :     this.borderColor,
      32              :     this.borderRadius,
      33              :     this.padding,
      34              :     this.minHeight,
      35              :     this.textStyle,
      36              :     this.shadow,
      37              :     this.iconSize,
      38              :     this.gap,
      39              :   });
      40              : 
      41              :   /// Resting fill of the trigger.
      42              :   final Color? backgroundColor;
      43              : 
      44              :   /// Color of the selected value text in the trigger.
      45              :   final Color? foregroundColor;
      46              : 
      47              :   /// Color of the placeholder text shown when nothing is picked.
      48              :   final Color? placeholderColor;
      49              : 
      50              :   /// Resting border color of the trigger.
      51              :   final Color? borderColor;
      52              : 
      53              :   /// Corner radius of the trigger and popup in logical pixels.
      54              :   final double? borderRadius;
      55              : 
      56              :   /// Horizontal padding inside the trigger.
      57              :   final EdgeInsetsGeometry? padding;
      58              : 
      59              :   /// Minimum height of the trigger in logical pixels.
      60              :   final double? minHeight;
      61              : 
      62              :   /// Style of the value and placeholder text. Its color is ignored; text color
      63              :   /// stays token-driven.
      64              :   final TextStyle? textStyle;
      65              : 
      66              :   /// Drop shadow layers on the resting trigger; empty for none.
      67              :   final List<BoxShadow>? shadow;
      68              : 
      69              :   /// Size of the trigger chevron and the row indicator in logical pixels.
      70              :   final double? iconSize;
      71              : 
      72              :   /// Gap between the value text and the chevron in logical pixels.
      73              :   final double? gap;
      74              : 
      75              :   /// Returns a copy with every non-null field of [other] laid over this one.
      76              :   ///
      77              :   /// ```dart
      78              :   /// const base = FossSelectStyle(minHeight: 36, gap: 8);
      79              :   /// const override = FossSelectStyle(gap: 4);
      80              :   /// base.merge(override); // minHeight 36 kept, gap becomes 4
      81              :   /// ```
      82            1 :   FossSelectStyle merge(FossSelectStyle? other) {
      83              :     if (other == null) return this;
      84            1 :     return FossSelectStyle(
      85            2 :       backgroundColor: other.backgroundColor ?? backgroundColor,
      86            2 :       foregroundColor: other.foregroundColor ?? foregroundColor,
      87            2 :       placeholderColor: other.placeholderColor ?? placeholderColor,
      88            2 :       borderColor: other.borderColor ?? borderColor,
      89            2 :       borderRadius: other.borderRadius ?? borderRadius,
      90            2 :       padding: other.padding ?? padding,
      91            2 :       minHeight: other.minHeight ?? minHeight,
      92            2 :       textStyle: other.textStyle ?? textStyle,
      93            2 :       shadow: other.shadow ?? shadow,
      94            2 :       iconSize: other.iconSize ?? iconSize,
      95            2 :       gap: other.gap ?? gap,
      96              :     );
      97              :   }
      98              : }
        

Generated by: LCOV version 2.0-1