LCOV - code coverage report
Current view: top level - theme - foss_theme_spec.dart Coverage Total Hit
Test: fossui coverage Lines: 100.0 % 1 1
Test Date: 2026-11-29 09:15:47 Functions: - 0 0

            Line data    Source code
       1              : import 'package:flutter/widgets.dart';
       2              : import 'package:fossui/src/theme/foss_theme.dart';
       3              : 
       4              : /// A compact override layer for retheming a [FossThemeData] in one call.
       5              : ///
       6              : /// Every field is optional; an unset field keeps the base theme's value. Colors
       7              : /// pass through enumerated (one role per field, no auto-contrast). The scales
       8              : /// are single seeds: [radius] derives the radius steps, [spacing] sets the
       9              : /// spacing unit, [shadowColor] re-tints every shadow layer, and [fontFamily]
      10              : /// applies across every type step. Layer it with [FossThemeData.retheme].
      11              : ///
      12              : /// ```dart
      13              : /// final theme = FossThemeData.light.retheme(
      14              : ///   const FossThemeSpec(
      15              : ///     primary: Color(0xFF51F0A8),
      16              : ///     primaryForeground: Color(0xFF000000),
      17              : ///     ring: Color(0xFF51F0A8),
      18              : ///     radius: 22,
      19              : ///     fontFamily: 'Plus Jakarta Sans',
      20              : ///   ),
      21              : /// );
      22              : /// ```
      23              : ///
      24              : /// For a light and dark pair, layer one spec over each base and give each its
      25              : /// own color values (dark usually wants brighter shades):
      26              : ///
      27              : /// ```dart
      28              : /// MaterialApp(
      29              : ///   theme: FossThemeData.light.retheme(
      30              : ///     const FossThemeSpec(primary: Color(0xFF16A34A), radius: 22),
      31              : ///   ).toThemeData(),
      32              : ///   darkTheme: FossThemeData.dark.retheme(
      33              : ///     const FossThemeSpec(primary: Color(0xFF51F0A8), radius: 22),
      34              : ///   ).toThemeData(),
      35              : /// );
      36              : /// ```
      37              : @immutable
      38              : class FossThemeSpec {
      39              :   /// Creates an override layer; every field defaults to null (keep the base).
      40            1 :   const FossThemeSpec({
      41              :     this.background,
      42              :     this.foreground,
      43              :     this.card,
      44              :     this.cardForeground,
      45              :     this.popover,
      46              :     this.popoverForeground,
      47              :     this.primary,
      48              :     this.primaryForeground,
      49              :     this.secondary,
      50              :     this.secondaryForeground,
      51              :     this.muted,
      52              :     this.mutedForeground,
      53              :     this.accent,
      54              :     this.accentForeground,
      55              :     this.destructive,
      56              :     this.destructiveForeground,
      57              :     this.destructiveForegroundOn,
      58              :     this.info,
      59              :     this.infoForeground,
      60              :     this.success,
      61              :     this.successForeground,
      62              :     this.warning,
      63              :     this.warningForeground,
      64              :     this.border,
      65              :     this.input,
      66              :     this.ring,
      67              :     this.radius,
      68              :     this.spacing,
      69              :     this.shadowColor,
      70              :     this.fontFamily,
      71              :   });
      72              : 
      73              :   /// App background override.
      74              :   final Color? background;
      75              : 
      76              :   /// Default text/icon color override.
      77              :   final Color? foreground;
      78              : 
      79              :   /// Card surface override.
      80              :   final Color? card;
      81              : 
      82              :   /// Text/icon color on the card override.
      83              :   final Color? cardForeground;
      84              : 
      85              :   /// Popover and menu surface override.
      86              :   final Color? popover;
      87              : 
      88              :   /// Text/icon color on the popover override.
      89              :   final Color? popoverForeground;
      90              : 
      91              :   /// Primary action color override.
      92              :   final Color? primary;
      93              : 
      94              :   /// Text/icon color on the primary color override.
      95              :   final Color? primaryForeground;
      96              : 
      97              :   /// Secondary surface override.
      98              :   final Color? secondary;
      99              : 
     100              :   /// Text/icon color on the secondary surface override.
     101              :   final Color? secondaryForeground;
     102              : 
     103              :   /// Muted surface override.
     104              :   final Color? muted;
     105              : 
     106              :   /// Low-emphasis text color override.
     107              :   final Color? mutedForeground;
     108              : 
     109              :   /// Accent surface override.
     110              :   final Color? accent;
     111              : 
     112              :   /// Text/icon color on the accent surface override.
     113              :   final Color? accentForeground;
     114              : 
     115              :   /// Destructive action color override.
     116              :   final Color? destructive;
     117              : 
     118              :   /// Text/icon color paired with the destructive color override.
     119              :   final Color? destructiveForeground;
     120              : 
     121              :   /// Text/icon color on a solid destructive fill override.
     122              :   final Color? destructiveForegroundOn;
     123              : 
     124              :   /// Informational accent override.
     125              :   final Color? info;
     126              : 
     127              :   /// Text/icon color paired with the info color override.
     128              :   final Color? infoForeground;
     129              : 
     130              :   /// Success accent override.
     131              :   final Color? success;
     132              : 
     133              :   /// Text/icon color paired with the success color override.
     134              :   final Color? successForeground;
     135              : 
     136              :   /// Warning accent override.
     137              :   final Color? warning;
     138              : 
     139              :   /// Text/icon color paired with the warning color override.
     140              :   final Color? warningForeground;
     141              : 
     142              :   /// Default border/divider color override.
     143              :   final Color? border;
     144              : 
     145              :   /// Form-control border color override.
     146              :   final Color? input;
     147              : 
     148              :   /// Focus ring color override.
     149              :   final Color? ring;
     150              : 
     151              :   /// Radius base in logical pixels; derives the full radius scale.
     152              :   final double? radius;
     153              : 
     154              :   /// Spacing unit in logical pixels; every step is `unit * n`.
     155              :   final double? spacing;
     156              : 
     157              :   /// Re-tints every shadow layer, keeping each layer's alpha and geometry.
     158              :   final Color? shadowColor;
     159              : 
     160              :   /// Font family applied across every type step.
     161              :   final String? fontFamily;
     162              : }
        

Generated by: LCOV version 2.0-1