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

            Line data    Source code
       1              : part of 'foss_calendar.dart';
       2              : 
       3              : /// Visual overrides for a [FossCalendar]. Every field is optional; a null field
       4              : /// falls back to the value the theme resolves. Pass one via `style:` to tweak a
       5              : /// single calendar without retheming every other one.
       6              : ///
       7              : /// A softer selected fill and tighter day corners:
       8              : ///
       9              : /// ```dart
      10              : /// FossCalendar.single(
      11              : ///   selected: picked,
      12              : ///   onSelected: onPick,
      13              : ///   style: const FossCalendarStyle(
      14              : ///     selectedColor: Color(0xFF6D28D9),
      15              : ///     dayRadius: 6,
      16              : ///   ),
      17              : /// );
      18              : /// ```
      19              : @FossSince('0.1.1')
      20              : @immutable
      21              : class FossCalendarStyle {
      22              :   /// Creates a set of calendar overrides. All fields default to null (inherit).
      23            1 :   const FossCalendarStyle({
      24              :     this.dayTextStyle,
      25              :     this.weekdayTextStyle,
      26              :     this.captionTextStyle,
      27              :     this.dayForegroundColor,
      28              :     this.mutedForegroundColor,
      29              :     this.selectedColor,
      30              :     this.selectedForegroundColor,
      31              :     this.rangeColor,
      32              :     this.hoverColor,
      33              :     this.todayIndicatorColor,
      34              :     this.selectedTodayIndicatorColor,
      35              :     this.focusRingColor,
      36              :     this.chevronColor,
      37              :     this.dayRadius,
      38              :     this.cellSize,
      39              :   });
      40              : 
      41              :   /// Text style for the day numbers.
      42              :   final TextStyle? dayTextStyle;
      43              : 
      44              :   /// Text style for the weekday header labels.
      45              :   final TextStyle? weekdayTextStyle;
      46              : 
      47              :   /// Text style for the month and year caption.
      48              :   final TextStyle? captionTextStyle;
      49              : 
      50              :   /// Color of an ordinary day number.
      51              :   final Color? dayForegroundColor;
      52              : 
      53              :   /// Color of outside-month and disabled day numbers, and the weekday header.
      54              :   final Color? mutedForegroundColor;
      55              : 
      56              :   /// Fill of a selected day and the range edges.
      57              :   final Color? selectedColor;
      58              : 
      59              :   /// Number color on a selected day and the range edges.
      60              :   final Color? selectedForegroundColor;
      61              : 
      62              :   /// Fill of the days between the range edges.
      63              :   final Color? rangeColor;
      64              : 
      65              :   /// Fill of a day under the pointer.
      66              :   final Color? hoverColor;
      67              : 
      68              :   /// Color of the today dot.
      69              :   final Color? todayIndicatorColor;
      70              : 
      71              :   /// Color of the today dot when today is selected.
      72              :   final Color? selectedTodayIndicatorColor;
      73              : 
      74              :   /// Color of the keyboard focus ring.
      75              :   final Color? focusRingColor;
      76              : 
      77              :   /// Color of the navigation chevrons.
      78              :   final Color? chevronColor;
      79              : 
      80              :   /// Corner radius of a day cell in logical pixels.
      81              :   final double? dayRadius;
      82              : 
      83              :   /// Edge length of a day cell in logical pixels.
      84              :   final double? cellSize;
      85              : 
      86              :   /// Returns a copy with every non-null field of [other] laid over this one.
      87              :   ///
      88              :   /// ```dart
      89              :   /// const base = FossCalendarStyle(dayRadius: 10);
      90              :   /// const override = FossCalendarStyle(dayRadius: 6);
      91              :   /// base.merge(override); // dayRadius becomes 6
      92              :   /// ```
      93            1 :   FossCalendarStyle merge(FossCalendarStyle? other) {
      94              :     if (other == null) return this;
      95            1 :     return FossCalendarStyle(
      96            2 :       dayTextStyle: other.dayTextStyle ?? dayTextStyle,
      97            2 :       weekdayTextStyle: other.weekdayTextStyle ?? weekdayTextStyle,
      98            2 :       captionTextStyle: other.captionTextStyle ?? captionTextStyle,
      99            2 :       dayForegroundColor: other.dayForegroundColor ?? dayForegroundColor,
     100            2 :       mutedForegroundColor: other.mutedForegroundColor ?? mutedForegroundColor,
     101            2 :       selectedColor: other.selectedColor ?? selectedColor,
     102              :       selectedForegroundColor:
     103            2 :           other.selectedForegroundColor ?? selectedForegroundColor,
     104            2 :       rangeColor: other.rangeColor ?? rangeColor,
     105            2 :       hoverColor: other.hoverColor ?? hoverColor,
     106            2 :       todayIndicatorColor: other.todayIndicatorColor ?? todayIndicatorColor,
     107              :       selectedTodayIndicatorColor:
     108            2 :           other.selectedTodayIndicatorColor ?? selectedTodayIndicatorColor,
     109            2 :       focusRingColor: other.focusRingColor ?? focusRingColor,
     110            2 :       chevronColor: other.chevronColor ?? chevronColor,
     111            2 :       dayRadius: other.dayRadius ?? dayRadius,
     112            2 :       cellSize: other.cellSize ?? cellSize,
     113              :     );
     114              :   }
     115              : }
        

Generated by: LCOV version 2.0-1