feat: remove edit template button as seperate button and add it to week overview element

This commit is contained in:
Freek van de Ven 2024-07-25 12:04:22 +02:00 committed by Bart Ribbers
parent 36d5cf3b92
commit 26d2eb150a
2 changed files with 22 additions and 11 deletions

View file

@ -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),

View file

@ -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(