fix: remove BasePage from week template modification

The weekday selection has no padding on the right side. To achieve this the screen isn't wrapped with a padding but only all the individual elements except the weekday selection.
This commit is contained in:
Freek van de Ven 2024-07-24 11:18:45 +02:00
parent 4eecef7b34
commit 97318ff8c0
2 changed files with 61 additions and 44 deletions

View file

@ -1,7 +1,6 @@
import "package:flutter/material.dart";
import "package:flutter_availability/src/ui/view_models/template_daydata_view_model.dart";
import "package:flutter_availability/src/ui/view_models/week_template_view_models.dart";
import "package:flutter_availability/src/ui/widgets/base_page.dart";
import "package:flutter_availability/src/ui/widgets/color_selection.dart";
import "package:flutter_availability/src/ui/widgets/template_name_input.dart";
import "package:flutter_availability/src/ui/widgets/template_time_break.dart";
@ -217,34 +216,54 @@ class _WeekTemplateModificationScreenState
),
);
return options.baseScreenBuilder(
context,
onBackPressed,
BasePage(
body: [
_WeekTemplateSidePadding(child: title),
const SizedBox(height: 24),
if (_editing) ...[
...editPage,
] else ...[
overviewPage,
var body = CustomScrollView(
slivers: [
SliverList.list(
children: [
const SizedBox(height: 40),
_WeekTemplateSidePadding(child: title),
const SizedBox(height: 24),
if (_editing) ...[
...editPage,
] else ...[
overviewPage,
],
const SizedBox(height: 32),
],
],
buttons: [
if (_editing) ...[
nextButton,
] else ...[
saveButton,
const SizedBox(height: 8),
previousButton,
],
if (widget.template != null) ...[
const SizedBox(height: 8),
deleteButton,
],
],
),
),
SliverFillRemaining(
fillOverscroll: false,
hasScrollBody: false,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: spacing.sidePadding,
).copyWith(
bottom: spacing.bottomButtonPadding,
),
child: Align(
alignment: Alignment.bottomCenter,
child: Column(
children: [
if (_editing) ...[
nextButton,
] else ...[
saveButton,
const SizedBox(height: 8),
previousButton,
],
if (widget.template != null) ...[
const SizedBox(height: 8),
deleteButton,
],
],
),
),
),
),
],
);
return options.baseScreenBuilder(context, onBackPressed, body);
}
}

View file

@ -61,6 +61,7 @@ class _TemplateWeekDaySelectionState extends State<TemplateWeekDaySelection> {
onDaySelected: (selected) =>
onDaySelected(selected, days.indexOf(day)),
),
const SizedBox(width: 8),
],
],
),
@ -125,25 +126,22 @@ class _DaySelectionCardLayout extends StatelessWidget {
)
: abbreviationTextStyle;
return Padding(
padding: const EdgeInsets.only(left: 8.0),
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
height: isSelected ? 72 : 64,
width: isSelected ? 72 : 64,
child: ChoiceChip(
shape: RoundedRectangleBorder(borderRadius: options.borderRadius),
padding: EdgeInsets.zero,
label: Center(
child: Text(
day.toUpperCase(),
style: abbreviationTextStyle,
),
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
height: isSelected ? 72 : 64,
width: isSelected ? 72 : 64,
child: ChoiceChip(
shape: RoundedRectangleBorder(borderRadius: options.borderRadius),
padding: EdgeInsets.zero,
label: Center(
child: Text(
day.toUpperCase(),
style: abbreviationTextStyle,
),
selected: isSelected,
showCheckmark: theme.chipTheme.showCheckmark ?? false,
onSelected: onDaySelected,
),
selected: isSelected,
showCheckmark: theme.chipTheme.showCheckmark ?? false,
onSelected: onDaySelected,
),
);
}