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

            Line data    Source code
       1              : part of 'foss_badge.dart';
       2              : 
       3              : /// Visual overrides for a single [FossBadge]. Every field is optional; a null
       4              : /// field falls back to the value the variant and theme resolve. Pass one via
       5              : /// `style:` to tweak a one-off without changing the theme.
       6              : ///
       7              : /// ```dart
       8              : /// FossBadge(
       9              : ///   label: const Text('Beta'),
      10              : ///   style: const FossBadgeStyle(borderRadius: 10),
      11              : /// );
      12              : /// ```
      13              : @immutable
      14              : class FossBadgeStyle {
      15              :   /// Creates a set of badge overrides. All fields default to null (inherit).
      16            1 :   const FossBadgeStyle({
      17              :     this.backgroundColor,
      18              :     this.borderColor,
      19              :     this.foregroundColor,
      20              :     this.borderRadius,
      21              :     this.labelStyle,
      22              :   });
      23              : 
      24              :   /// Fill of the pill.
      25              :   final Color? backgroundColor;
      26              : 
      27              :   /// Color of the 1px border. Null leaves the variant's border unchanged.
      28              :   final Color? borderColor;
      29              : 
      30              :   /// Color of the label text and the icon slots.
      31              :   final Color? foregroundColor;
      32              : 
      33              :   /// Corner radius in logical pixels.
      34              :   final double? borderRadius;
      35              : 
      36              :   /// Style of the [FossBadge.label]. Merged over the token default.
      37              :   final TextStyle? labelStyle;
      38              : 
      39              :   /// Returns a copy with every non-null field of [other] laid over this one.
      40            1 :   FossBadgeStyle merge(FossBadgeStyle? other) {
      41              :     if (other == null) return this;
      42            1 :     return FossBadgeStyle(
      43            2 :       backgroundColor: other.backgroundColor ?? backgroundColor,
      44            2 :       borderColor: other.borderColor ?? borderColor,
      45            1 :       foregroundColor: other.foregroundColor ?? foregroundColor,
      46            1 :       borderRadius: other.borderRadius ?? borderRadius,
      47            2 :       labelStyle: other.labelStyle ?? labelStyle,
      48              :     );
      49              :   }
      50              : }
        

Generated by: LCOV version 2.0-1