From 81a9e2cfb0bd0dc8d84c5103716c07842f894211 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 2 Feb 2026 21:55:33 -0500 Subject: [PATCH] feat: update coverage display logic to show status only when applicable --- .../widgets/coverage_dashboard.dart | 29 ++++++----- .../presentation/widgets/coverage_widget.dart | 51 +++++++++---------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart index 6bd4565d..20272bdd 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart @@ -73,22 +73,23 @@ class CoverageDashboard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("Today's Status", style: UiTypography.body1m.textSecondary), - Container( - padding: const EdgeInsets.symmetric( - horizontal: UiConstants.space2, - vertical: 2.0, - ), - decoration: BoxDecoration( - color: coverageBadgeColor, - borderRadius: UiConstants.radiusMd, - ), - child: Text( - '$coveragePercent% Covered', - style: UiTypography.footnote1b.copyWith( - color: coverageTextColor, + if (totalNeeded > 0 || totalConfirmed > 0) + Container( + padding: const EdgeInsets.symmetric( + horizontal: UiConstants.space2, + vertical: 2.0, + ), + decoration: BoxDecoration( + color: coverageBadgeColor, + borderRadius: UiConstants.radiusMd, + ), + child: Text( + '$coveragePercent% Covered', + style: UiTypography.footnote1b.copyWith( + color: coverageTextColor, + ), ), ), - ), ], ), const SizedBox(height: UiConstants.space4), diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart index 5c5769e2..3dfaf5f7 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart @@ -53,30 +53,26 @@ class CoverageWidget extends StatelessWidget { letterSpacing: 0.5, ), ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: UiConstants.space2, - vertical: - 2, // 2px is not in metrics, using hardcoded for small tweaks or space0/space1 - ), - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: UiConstants.radiusLg, - ), - child: Text( - '$coveragePercent% Covered', - style: UiTypography.footnote2b.copyWith( - color: textColor, + if (totalNeeded > 0 || totalConfirmed > 0 || coveragePercent > 0) + Container( + padding: const EdgeInsets.symmetric( + horizontal: UiConstants.space2, + vertical: + 2, // 2px is not in metrics, using hardcoded for small tweaks or space0/space1 + ), + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: UiConstants.radiusLg, + ), + child: Text( + '$coveragePercent% Covered', + style: UiTypography.footnote2b.copyWith(color: textColor), ), ), - ), ], ), if (subtitle != null) ...[ - Text( - subtitle!, - style: UiTypography.body2r.textSecondary, - ), + Text(subtitle!, style: UiTypography.body2r.textSecondary), ], const SizedBox(height: UiConstants.space6), Row( @@ -90,15 +86,16 @@ class CoverageWidget extends StatelessWidget { ), ), const SizedBox(width: UiConstants.space2), - if (totalConfirmed != 0) Expanded( - child: _MetricCard( - icon: UiIcons.success, - iconColor: UiColors.iconSuccess, - label: 'Filled', - value: '$totalConfirmed', - valueColor: UiColors.textSuccess, + if (totalConfirmed != 0) + Expanded( + child: _MetricCard( + icon: UiIcons.success, + iconColor: UiColors.iconSuccess, + label: 'Filled', + value: '$totalConfirmed', + valueColor: UiColors.textSuccess, + ), ), - ), const SizedBox(width: UiConstants.space2), Expanded( child: _MetricCard(