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

            Line data    Source code
       1              : part of 'foss_slider.dart';
       2              : 
       3              : /// Visual overrides for a single [FossSlider]. Every field is optional; a null
       4              : /// field falls back to the value the theme resolves. Pass one via `style:` to
       5              : /// tweak a one-off without changing the theme for every other slider.
       6              : ///
       7              : /// State-derived colors (the focus ring) stay token-driven. To restyle those
       8              : /// globally, retheme `FossColors`.
       9              : ///
      10              : /// A taller track with a custom filled range:
      11              : ///
      12              : /// ```dart
      13              : /// FossSlider(
      14              : ///   value: 40,
      15              : ///   onChanged: (v) {},
      16              : ///   style: const FossSliderStyle(
      17              : ///     trackHeight: 6,
      18              : ///     rangeColor: Color(0xFF8A38F5),
      19              : ///   ),
      20              : /// );
      21              : /// ```
      22              : @immutable
      23              : class FossSliderStyle {
      24              :   /// Creates a set of slider overrides. All fields default to null (inherit).
      25            1 :   const FossSliderStyle({
      26              :     this.trackColor,
      27              :     this.rangeColor,
      28              :     this.thumbColor,
      29              :     this.borderColor,
      30              :     this.shadow,
      31              :     this.trackHeight,
      32              :     this.thumbSize,
      33              :   });
      34              : 
      35              :   /// Color of the unfilled track.
      36              :   final Color? trackColor;
      37              : 
      38              :   /// Color of the filled range from the start to the thumb.
      39              :   final Color? rangeColor;
      40              : 
      41              :   /// Fill color of the thumb knob.
      42              :   final Color? thumbColor;
      43              : 
      44              :   /// Border color of the thumb.
      45              :   final Color? borderColor;
      46              : 
      47              :   /// Drop shadow layers on the resting thumb; empty for none.
      48              :   final List<BoxShadow>? shadow;
      49              : 
      50              :   /// Height of the track in logical pixels.
      51              :   final double? trackHeight;
      52              : 
      53              :   /// Diameter of the thumb in logical pixels.
      54              :   final double? thumbSize;
      55              : 
      56              :   /// Returns a copy with every non-null field of [other] laid over this one.
      57              :   ///
      58              :   /// ```dart
      59              :   /// const base = FossSliderStyle(trackHeight: 4, thumbSize: 20);
      60              :   /// const override = FossSliderStyle(thumbSize: 24);
      61              :   /// base.merge(override); // trackHeight 4 kept, thumbSize becomes 24
      62              :   /// ```
      63            1 :   FossSliderStyle merge(FossSliderStyle? other) {
      64              :     if (other == null) return this;
      65            1 :     return FossSliderStyle(
      66            2 :       trackColor: other.trackColor ?? trackColor,
      67            2 :       rangeColor: other.rangeColor ?? rangeColor,
      68            2 :       thumbColor: other.thumbColor ?? thumbColor,
      69            2 :       borderColor: other.borderColor ?? borderColor,
      70            2 :       shadow: other.shadow ?? shadow,
      71            2 :       trackHeight: other.trackHeight ?? trackHeight,
      72            2 :       thumbSize: other.thumbSize ?? thumbSize,
      73              :     );
      74              :   }
      75              : }
        

Generated by: LCOV version 2.0-1