feat: update coverage display logic to show status only when applicable

This commit is contained in:
Achintha Isuru
2026-02-02 21:55:33 -05:00
parent 2f6ad5578e
commit 81a9e2cfb0
2 changed files with 39 additions and 41 deletions

View File

@@ -73,22 +73,23 @@ class CoverageDashboard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Text("Today's Status", style: UiTypography.body1m.textSecondary), Text("Today's Status", style: UiTypography.body1m.textSecondary),
Container( if (totalNeeded > 0 || totalConfirmed > 0)
padding: const EdgeInsets.symmetric( Container(
horizontal: UiConstants.space2, padding: const EdgeInsets.symmetric(
vertical: 2.0, horizontal: UiConstants.space2,
), vertical: 2.0,
decoration: BoxDecoration( ),
color: coverageBadgeColor, decoration: BoxDecoration(
borderRadius: UiConstants.radiusMd, color: coverageBadgeColor,
), borderRadius: UiConstants.radiusMd,
child: Text( ),
'$coveragePercent% Covered', child: Text(
style: UiTypography.footnote1b.copyWith( '$coveragePercent% Covered',
color: coverageTextColor, style: UiTypography.footnote1b.copyWith(
color: coverageTextColor,
),
), ),
), ),
),
], ],
), ),
const SizedBox(height: UiConstants.space4), const SizedBox(height: UiConstants.space4),

View File

@@ -53,30 +53,26 @@ class CoverageWidget extends StatelessWidget {
letterSpacing: 0.5, letterSpacing: 0.5,
), ),
), ),
Container( if (totalNeeded > 0 || totalConfirmed > 0 || coveragePercent > 0)
padding: const EdgeInsets.symmetric( Container(
horizontal: UiConstants.space2, padding: const EdgeInsets.symmetric(
vertical: horizontal: UiConstants.space2,
2, // 2px is not in metrics, using hardcoded for small tweaks or space0/space1 vertical:
), 2, // 2px is not in metrics, using hardcoded for small tweaks or space0/space1
decoration: BoxDecoration( ),
color: backgroundColor, decoration: BoxDecoration(
borderRadius: UiConstants.radiusLg, color: backgroundColor,
), borderRadius: UiConstants.radiusLg,
child: Text( ),
'$coveragePercent% Covered', child: Text(
style: UiTypography.footnote2b.copyWith( '$coveragePercent% Covered',
color: textColor, style: UiTypography.footnote2b.copyWith(color: textColor),
), ),
), ),
),
], ],
), ),
if (subtitle != null) ...<Widget>[ if (subtitle != null) ...<Widget>[
Text( Text(subtitle!, style: UiTypography.body2r.textSecondary),
subtitle!,
style: UiTypography.body2r.textSecondary,
),
], ],
const SizedBox(height: UiConstants.space6), const SizedBox(height: UiConstants.space6),
Row( Row(
@@ -90,15 +86,16 @@ class CoverageWidget extends StatelessWidget {
), ),
), ),
const SizedBox(width: UiConstants.space2), const SizedBox(width: UiConstants.space2),
if (totalConfirmed != 0) Expanded( if (totalConfirmed != 0)
child: _MetricCard( Expanded(
icon: UiIcons.success, child: _MetricCard(
iconColor: UiColors.iconSuccess, icon: UiIcons.success,
label: 'Filled', iconColor: UiColors.iconSuccess,
value: '$totalConfirmed', label: 'Filled',
valueColor: UiColors.textSuccess, value: '$totalConfirmed',
valueColor: UiColors.textSuccess,
),
), ),
),
const SizedBox(width: UiConstants.space2), const SizedBox(width: UiConstants.space2),
Expanded( Expanded(
child: _MetricCard( child: _MetricCard(