From 26d2eb150a6b35d72a61640f78bc4811f19acb5e Mon Sep 17 00:00:00 2001 From: Freek van de Ven Date: Thu, 25 Jul 2024 12:04:22 +0200 Subject: [PATCH] feat: remove edit template button as seperate button and add it to week overview element --- .../screens/template_week_modification.dart | 9 +------ .../ui/widgets/template_week_overview.dart | 24 ++++++++++++++++--- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/flutter_availability/lib/src/ui/screens/template_week_modification.dart b/packages/flutter_availability/lib/src/ui/screens/template_week_modification.dart index 1cd142a..7e843dd 100644 --- a/packages/flutter_availability/lib/src/ui/screens/template_week_modification.dart +++ b/packages/flutter_availability/lib/src/ui/screens/template_week_modification.dart @@ -130,12 +130,6 @@ class _WeekTemplateModificationScreenState Text(translations.deleteTemplateButton), ); - var previousButton = options.bigTextButtonBuilder( - context, - onBackPressed, - Text(translations.editTemplateButton), - ); - var title = Center( child: Text( translations.weekTemplateTitle, @@ -223,6 +217,7 @@ class _WeekTemplateModificationScreenState const SizedBox(height: 30), TemplateWeekOverview( template: _viewModel, + onClickEdit: onBackPressed, ), ], ), @@ -260,8 +255,6 @@ class _WeekTemplateModificationScreenState nextButton, ] else ...[ saveButton, - const SizedBox(height: 8), - previousButton, ], if (widget.template != null) ...[ const SizedBox(height: 8), diff --git a/packages/flutter_availability/lib/src/ui/widgets/template_week_overview.dart b/packages/flutter_availability/lib/src/ui/widgets/template_week_overview.dart index 37d9cf8..9a3540b 100644 --- a/packages/flutter_availability/lib/src/ui/widgets/template_week_overview.dart +++ b/packages/flutter_availability/lib/src/ui/widgets/template_week_overview.dart @@ -11,12 +11,16 @@ class TemplateWeekOverview extends StatelessWidget { /// const TemplateWeekOverview({ required this.template, + required this.onClickEdit, super.key, }); /// The template to show final WeekTemplateViewModel template; + /// The callback for the textbutton to edit the week template + final VoidCallback onClickEdit; + @override Widget build(BuildContext context) { var theme = Theme.of(context); @@ -33,9 +37,23 @@ class TemplateWeekOverview extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - translations.weekTemplateOverviewTitle, - style: textTheme.titleMedium, + Row( + children: [ + Expanded( + child: Text( + translations.weekTemplateOverviewTitle, + style: textTheme.titleMedium, + overflow: TextOverflow.ellipsis, + ), + ), + options.smallTextButtonBuilder( + context, + onClickEdit, + Text( + translations.editTemplateButton, + ), + ), + ], ), const SizedBox(height: 8), DecoratedBox(