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

            Line data    Source code
       1              : part of 'foss_rating.dart';
       2              : 
       3              : /// Visual overrides for a single [FossRating]. 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 rating.
       6              : ///
       7              : /// State-derived colors (the focus ring) stay token-driven. To restyle those
       8              : /// globally, retheme `FossColors`.
       9              : ///
      10              : /// An amber rating with larger marks:
      11              : ///
      12              : /// ```dart
      13              : /// FossRating(
      14              : ///   value: 4,
      15              : ///   style: const FossRatingStyle(
      16              : ///     filledColor: Color(0xFFF59E0B),
      17              : ///     glyphSize: 28,
      18              : ///   ),
      19              : /// );
      20              : /// ```
      21              : @immutable
      22              : @FossSince('0.1.3')
      23              : class FossRatingStyle {
      24              :   /// Creates a set of rating overrides. All fields default to null (inherit).
      25            1 :   const FossRatingStyle({
      26              :     this.filledColor,
      27              :     this.emptyColor,
      28              :     this.glyphSize,
      29              :     this.gap,
      30              :   });
      31              : 
      32              :   /// Color of a filled mark.
      33              :   final Color? filledColor;
      34              : 
      35              :   /// Color of an unfilled mark.
      36              :   final Color? emptyColor;
      37              : 
      38              :   /// Square extent of each mark in logical pixels.
      39              :   final double? glyphSize;
      40              : 
      41              :   /// Space between marks in logical pixels. Ignored on an interactive row,
      42              :   /// where the gap sits inside each mark's tap target.
      43              :   final double? gap;
      44              : 
      45              :   /// Returns a copy with every non-null field of [other] laid over this one.
      46              :   ///
      47              :   /// ```dart
      48              :   /// const base = FossRatingStyle(glyphSize: 20, gap: 4);
      49              :   /// const override = FossRatingStyle(glyphSize: 28);
      50              :   /// base.merge(override); // gap 4 kept, glyphSize becomes 28
      51              :   /// ```
      52            1 :   FossRatingStyle merge(FossRatingStyle? other) {
      53              :     if (other == null) return this;
      54            1 :     return FossRatingStyle(
      55            2 :       filledColor: other.filledColor ?? filledColor,
      56            2 :       emptyColor: other.emptyColor ?? emptyColor,
      57            2 :       glyphSize: other.glyphSize ?? glyphSize,
      58            2 :       gap: other.gap ?? gap,
      59              :     );
      60              :   }
      61              : }
        

Generated by: LCOV version 2.0-1