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), Text(translations.deleteTemplateButton),
); );
var previousButton = options.bigTextButtonBuilder(
context,
onBackPressed,
Text(translations.editTemplateButton),
);
var title = Center( var title = Center(
child: Text( child: Text(
translations.weekTemplateTitle, translations.weekTemplateTitle,
@ -223,6 +217,7 @@ class _WeekTemplateModificationScreenState
const SizedBox(height: 30), const SizedBox(height: 30),
TemplateWeekOverview( TemplateWeekOverview(
template: _viewModel, template: _viewModel,
onClickEdit: onBackPressed,
), ),
], ],
), ),
@ -260,8 +255,6 @@ class _WeekTemplateModificationScreenState
nextButton, nextButton,
] else ...[ ] else ...[
saveButton, saveButton,
const SizedBox(height: 8),
previousButton,
], ],
if (widget.template != null) ...[ if (widget.template != null) ...[
const SizedBox(height: 8), const SizedBox(height: 8),

View file

@ -11,12 +11,16 @@ class TemplateWeekOverview extends StatelessWidget {
/// ///
const TemplateWeekOverview({ const TemplateWeekOverview({
required this.template, required this.template,
required this.onClickEdit,
super.key, super.key,
}); });
/// The template to show /// The template to show
final WeekTemplateViewModel template; final WeekTemplateViewModel template;
/// The callback for the textbutton to edit the week template
final VoidCallback onClickEdit;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var theme = Theme.of(context); var theme = Theme.of(context);
@ -33,9 +37,23 @@ class TemplateWeekOverview extends StatelessWidget {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Row(
translations.weekTemplateOverviewTitle, children: [
style: textTheme.titleMedium, Expanded(
child: Text(
translations.weekTemplateOverviewTitle,
style: textTheme.titleMedium,
overflow: TextOverflow.ellipsis,
),
),
options.smallTextButtonBuilder(
context,
onClickEdit,
Text(
translations.editTemplateButton,
),
),
],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
DecoratedBox( DecoratedBox(