feat: Add subtitle support to SectionLayout in various widgets

This commit is contained in:
Achintha Isuru
2026-03-03 22:11:51 -05:00
parent 6f2a195724
commit 0726f1dfbb
7 changed files with 21 additions and 23 deletions

View File

@@ -27,7 +27,6 @@ class ActionsWidget extends StatelessWidget {
final TranslationsClientHomeActionsEn i18n = t.client_home.actions;
return SectionLayout(
title: title,
child: Row(
spacing: UiConstants.space4,
children: <Widget>[

View File

@@ -62,13 +62,6 @@ class CoverageDashboard extends StatelessWidget {
color: UiColors.white,
borderRadius: UiConstants.radiusLg,
border: Border.all(color: UiColors.border, width: 0.5),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withValues(alpha: 0.02),
blurRadius: 4,
offset: const Offset(0, 1),
),
],
),
child: Column(
children: <Widget>[
@@ -171,17 +164,17 @@ class _StatusCard extends StatelessWidget {
Color textColor = UiColors.textPrimary;
if (isWarning) {
bg = UiColors.tagPending;
border = UiColors.borderStill;
bg = UiColors.tagPending.withAlpha(80);
border = UiColors.textWarning.withAlpha(80);
iconColor = UiColors.textWarning;
textColor = UiColors.textWarning;
} else if (isError) {
bg = UiColors.tagError;
border = UiColors.borderError;
bg = UiColors.tagError.withAlpha(80);
border = UiColors.borderError.withAlpha(80);
iconColor = UiColors.textError;
textColor = UiColors.textError;
} else if (isInfo) {
bg = UiColors.tagInProgress;
bg = UiColors.tagInProgress.withAlpha(80);
border = UiColors.primary.withValues(alpha: 0.2);
iconColor = UiColors.primary;
textColor = UiColors.primary;

View File

@@ -35,6 +35,7 @@ class CoverageWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SectionLayout(
title: title,
subtitle: subtitle,
action: totalNeeded > 0 || totalConfirmed > 0 || coveragePercent > 0
? t.client_home.dashboard.percent_covered(percent: coveragePercent)
: null,

View File

@@ -113,6 +113,7 @@ class _LiveActivityWidgetState extends State<LiveActivityWidget> {
return SectionLayout(
title: widget.title,
subtitle: widget.subtitle,
action: i18n.dashboard.view_all,
onAction: widget.onViewAllPressed,
child: FutureBuilder<_LiveActivityData>(

View File

@@ -38,6 +38,7 @@ class ReorderWidget extends StatelessWidget {
return SectionLayout(
title: title,
subtitle: subtitle,
child: SizedBox(
height: 164,
child: ListView.separated(

View File

@@ -4,6 +4,15 @@ import 'package:design_system/design_system.dart';
/// Section header widget for home page sections, using design system tokens.
class SectionHeader extends StatelessWidget {
/// Creates a [SectionHeader].
const SectionHeader({
super.key,
required this.title,
this.subtitle,
this.action,
this.onAction,
});
/// Section title
final String title;
@@ -16,22 +25,15 @@ class SectionHeader extends StatelessWidget {
/// Optional action callback
final VoidCallback? onAction;
/// Creates a [SectionHeader].
const SectionHeader({
super.key,
required this.title,
this.subtitle,
this.action,
this.onAction,
});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: UiConstants.space3),
padding: subtitle != null
? EdgeInsets.zero
: const EdgeInsets.only(bottom: UiConstants.space3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[

View File

@@ -39,6 +39,7 @@ class SpendingWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SectionLayout(
title: title,
subtitle: subtitle,
child: Container(
padding: const EdgeInsets.all(UiConstants.space3),
decoration: BoxDecoration(