LCOV - code coverage report
Current view: top level - icons/glyphs - star.dart Coverage Total Hit
Test: fossui coverage Lines: 100.0 % 6 6
Test Date: 2026-11-29 09:15:47 Functions: - 0 0

            Line data    Source code
       1              : part of '../foss_glyph.dart';
       2              : 
       3              : /// A five-point star, the rating mark. Authored on a 24-unit grid.
       4              : ///
       5              : /// One shape serves both layers of a rating: [filled] paints it solid, the
       6              : /// default strokes it as an outline. Sharing the vertices means a partially
       7              : /// filled star cannot drift into two differently shaped halves.
       8              : class StarGlyph extends FossGlyph {
       9              :   /// Creates a star glyph in [color], solid when [filled].
      10            2 :   const StarGlyph(super.color, {this.filled = false});
      11              : 
      12              :   /// Whether the star is painted solid rather than stroked as an outline.
      13              :   final bool filled;
      14              : 
      15              :   // The ten vertices of a regular five-point star about the grid center, outer
      16              :   // radius 11 and inner radius 4.2, the first point at the top. The inner
      17              :   // radius is the one that keeps each of the ten edges straight.
      18              :   static const List<(double, double)> _points = [
      19              :     (12 / 24, 1 / 24),
      20              :     (14.47 / 24, 8.6 / 24),
      21              :     (22.46 / 24, 8.6 / 24),
      22              :     (15.99 / 24, 13.3 / 24),
      23              :     (18.47 / 24, 20.9 / 24),
      24              :     (12 / 24, 16.2 / 24),
      25              :     (5.53 / 24, 20.9 / 24),
      26              :     (8.01 / 24, 13.3 / 24),
      27              :     (1.54 / 24, 8.6 / 24),
      28              :     (9.53 / 24, 8.6 / 24),
      29              :   ];
      30              : 
      31            2 :   @override
      32              :   double get _stroke => 0.09;
      33              : 
      34            2 :   @override
      35              :   void _draw(_Pen pen) =>
      36            6 :       filled ? pen.shape(_points) : pen.path(_points, close: true);
      37              : 
      38            2 :   @override
      39              :   bool shouldRepaint(covariant StarGlyph old) =>
      40           12 :       old.color != color || old.filled != filled;
      41              : }
        

Generated by: LCOV version 2.0-1