feat: Add subtitle support to SectionLayout in various widgets
This commit is contained in:
@@ -27,7 +27,6 @@ class ActionsWidget extends StatelessWidget {
|
|||||||
final TranslationsClientHomeActionsEn i18n = t.client_home.actions;
|
final TranslationsClientHomeActionsEn i18n = t.client_home.actions;
|
||||||
|
|
||||||
return SectionLayout(
|
return SectionLayout(
|
||||||
title: title,
|
|
||||||
child: Row(
|
child: Row(
|
||||||
spacing: UiConstants.space4,
|
spacing: UiConstants.space4,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -62,13 +62,6 @@ class CoverageDashboard extends StatelessWidget {
|
|||||||
color: UiColors.white,
|
color: UiColors.white,
|
||||||
borderRadius: UiConstants.radiusLg,
|
borderRadius: UiConstants.radiusLg,
|
||||||
border: Border.all(color: UiColors.border, width: 0.5),
|
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(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -171,17 +164,17 @@ class _StatusCard extends StatelessWidget {
|
|||||||
Color textColor = UiColors.textPrimary;
|
Color textColor = UiColors.textPrimary;
|
||||||
|
|
||||||
if (isWarning) {
|
if (isWarning) {
|
||||||
bg = UiColors.tagPending;
|
bg = UiColors.tagPending.withAlpha(80);
|
||||||
border = UiColors.borderStill;
|
border = UiColors.textWarning.withAlpha(80);
|
||||||
iconColor = UiColors.textWarning;
|
iconColor = UiColors.textWarning;
|
||||||
textColor = UiColors.textWarning;
|
textColor = UiColors.textWarning;
|
||||||
} else if (isError) {
|
} else if (isError) {
|
||||||
bg = UiColors.tagError;
|
bg = UiColors.tagError.withAlpha(80);
|
||||||
border = UiColors.borderError;
|
border = UiColors.borderError.withAlpha(80);
|
||||||
iconColor = UiColors.textError;
|
iconColor = UiColors.textError;
|
||||||
textColor = UiColors.textError;
|
textColor = UiColors.textError;
|
||||||
} else if (isInfo) {
|
} else if (isInfo) {
|
||||||
bg = UiColors.tagInProgress;
|
bg = UiColors.tagInProgress.withAlpha(80);
|
||||||
border = UiColors.primary.withValues(alpha: 0.2);
|
border = UiColors.primary.withValues(alpha: 0.2);
|
||||||
iconColor = UiColors.primary;
|
iconColor = UiColors.primary;
|
||||||
textColor = UiColors.primary;
|
textColor = UiColors.primary;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class CoverageWidget extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SectionLayout(
|
return SectionLayout(
|
||||||
title: title,
|
title: title,
|
||||||
|
subtitle: subtitle,
|
||||||
action: totalNeeded > 0 || totalConfirmed > 0 || coveragePercent > 0
|
action: totalNeeded > 0 || totalConfirmed > 0 || coveragePercent > 0
|
||||||
? t.client_home.dashboard.percent_covered(percent: coveragePercent)
|
? t.client_home.dashboard.percent_covered(percent: coveragePercent)
|
||||||
: null,
|
: null,
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ class _LiveActivityWidgetState extends State<LiveActivityWidget> {
|
|||||||
|
|
||||||
return SectionLayout(
|
return SectionLayout(
|
||||||
title: widget.title,
|
title: widget.title,
|
||||||
|
subtitle: widget.subtitle,
|
||||||
action: i18n.dashboard.view_all,
|
action: i18n.dashboard.view_all,
|
||||||
onAction: widget.onViewAllPressed,
|
onAction: widget.onViewAllPressed,
|
||||||
child: FutureBuilder<_LiveActivityData>(
|
child: FutureBuilder<_LiveActivityData>(
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class ReorderWidget extends StatelessWidget {
|
|||||||
|
|
||||||
return SectionLayout(
|
return SectionLayout(
|
||||||
title: title,
|
title: title,
|
||||||
|
subtitle: subtitle,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 164,
|
height: 164,
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import 'package:design_system/design_system.dart';
|
|||||||
|
|
||||||
/// Section header widget for home page sections, using design system tokens.
|
/// Section header widget for home page sections, using design system tokens.
|
||||||
class SectionHeader extends StatelessWidget {
|
class SectionHeader extends StatelessWidget {
|
||||||
|
|
||||||
|
/// Creates a [SectionHeader].
|
||||||
|
const SectionHeader({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
this.subtitle,
|
||||||
|
this.action,
|
||||||
|
this.onAction,
|
||||||
|
});
|
||||||
/// Section title
|
/// Section title
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
@@ -16,22 +25,15 @@ class SectionHeader extends StatelessWidget {
|
|||||||
/// Optional action callback
|
/// Optional action callback
|
||||||
final VoidCallback? onAction;
|
final VoidCallback? onAction;
|
||||||
|
|
||||||
/// Creates a [SectionHeader].
|
|
||||||
const SectionHeader({
|
|
||||||
super.key,
|
|
||||||
required this.title,
|
|
||||||
this.subtitle,
|
|
||||||
this.action,
|
|
||||||
this.onAction,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: UiConstants.space3),
|
padding: subtitle != null
|
||||||
|
? EdgeInsets.zero
|
||||||
|
: const EdgeInsets.only(bottom: UiConstants.space3),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class SpendingWidget extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SectionLayout(
|
return SectionLayout(
|
||||||
title: title,
|
title: title,
|
||||||
|
subtitle: subtitle,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(UiConstants.space3),
|
padding: const EdgeInsets.all(UiConstants.space3),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
Reference in New Issue
Block a user