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/material.dart";
import "package:flutter_availability/src/ui/view_models/template_daydata_view_model.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/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/color_selection.dart";
import "package:flutter_availability/src/ui/widgets/template_name_input.dart"; import "package:flutter_availability/src/ui/widgets/template_name_input.dart";
import "package:flutter_availability/src/ui/widgets/template_time_break.dart"; import "package:flutter_availability/src/ui/widgets/template_time_break.dart";
@ -217,34 +216,54 @@ class _WeekTemplateModificationScreenState
), ),
); );
return options.baseScreenBuilder( var body = CustomScrollView(
context, slivers: [
onBackPressed, SliverList.list(
BasePage( children: [
body: [ const SizedBox(height: 40),
_WeekTemplateSidePadding(child: title), _WeekTemplateSidePadding(child: title),
const SizedBox(height: 24), const SizedBox(height: 24),
if (_editing) ...[ if (_editing) ...[
...editPage, ...editPage,
] else ...[ ] else ...[
overviewPage, overviewPage,
],
const SizedBox(height: 32),
], ],
], ),
buttons: [ SliverFillRemaining(
if (_editing) ...[ fillOverscroll: false,
nextButton, hasScrollBody: false,
] else ...[ child: Padding(
saveButton, padding: EdgeInsets.symmetric(
const SizedBox(height: 8), horizontal: spacing.sidePadding,
previousButton, ).copyWith(
], bottom: spacing.bottomButtonPadding,
if (widget.template != null) ...[ ),
const SizedBox(height: 8), child: Align(
deleteButton, 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) =>
onDaySelected(selected, days.indexOf(day)), onDaySelected(selected, days.indexOf(day)),
), ),
const SizedBox(width: 8),
], ],
], ],
), ),
@ -125,25 +126,22 @@ class _DaySelectionCardLayout extends StatelessWidget {
) )
: abbreviationTextStyle; : abbreviationTextStyle;
return Padding( return AnimatedContainer(
padding: const EdgeInsets.only(left: 8.0), duration: const Duration(milliseconds: 300),
child: AnimatedContainer( height: isSelected ? 72 : 64,
duration: const Duration(milliseconds: 300), width: isSelected ? 72 : 64,
height: isSelected ? 72 : 64, child: ChoiceChip(
width: isSelected ? 72 : 64, shape: RoundedRectangleBorder(borderRadius: options.borderRadius),
child: ChoiceChip( padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: options.borderRadius), label: Center(
padding: EdgeInsets.zero, child: Text(
label: Center( day.toUpperCase(),
child: Text( style: abbreviationTextStyle,
day.toUpperCase(),
style: abbreviationTextStyle,
),
), ),
selected: isSelected,
showCheckmark: theme.chipTheme.showCheckmark ?? false,
onSelected: onDaySelected,
), ),
selected: isSelected,
showCheckmark: theme.chipTheme.showCheckmark ?? false,
onSelected: onDaySelected,
), ),
); );
} }