From 0852b2567837475e4018e899279dea7859389b3f Mon Sep 17 00:00:00 2001 From: Freek van de Ven Date: Fri, 26 Jul 2024 15:56:53 +0200 Subject: [PATCH] fix: add keyboard padding for pause selection dialog --- .../lib/src/ui/widgets/pause_selection.dart | 109 +++++++++--------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/packages/flutter_availability/lib/src/ui/widgets/pause_selection.dart b/packages/flutter_availability/lib/src/ui/widgets/pause_selection.dart index f46f049..c01f8a3 100644 --- a/packages/flutter_availability/lib/src/ui/widgets/pause_selection.dart +++ b/packages/flutter_availability/lib/src/ui/widgets/pause_selection.dart @@ -316,61 +316,66 @@ class _AvailabilityBreakSelectionDialogState return Stack( children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: spacing.sidePadding, + Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, ), child: SingleChildScrollView( - child: Column( - children: [ - const SizedBox(height: 44), - Text( - translations.pauseDialogTitle, - style: textTheme.titleMedium, - textAlign: TextAlign.center, - ), - const SizedBox(height: 4), - Text( - descriptionText, - style: textTheme.bodyMedium, - textAlign: TextAlign.center, - ), - const SizedBox(height: 16), - Row( - children: [ - const Spacer( - flex: 3, - ), - Expanded( - flex: 4, - child: DurationInputField( - initialValue: _breakViewModel.submittedDuration, - onDurationChanged: onUpdateDuration, - ), - ), - const Spacer( - flex: 3, - ), - ], - ), - const SizedBox(height: 24), - TimeSelection( - key: ValueKey( - [_breakViewModel.startTime, _breakViewModel.endTime], + child: Container( + margin: EdgeInsets.symmetric( + horizontal: spacing.sidePadding, + ), + child: Column( + children: [ + const SizedBox(height: 44), + Text( + translations.pauseDialogTitle, + style: textTheme.titleMedium, + textAlign: TextAlign.center, ), - // rebuild the widget when the start or end time changes - title: translations.pauseDialogPeriodTitle, - description: translations.pauseDialogPeriodDescription, - crossAxisAlignment: CrossAxisAlignment.center, - startTime: _breakViewModel.startTime, - endTime: _breakViewModel.endTime, - onStartChanged: onUpdateStart, - onEndChanged: onUpdateEnd, - ), - const SizedBox(height: 36), - saveButton, - SizedBox(height: spacing.bottomButtonPadding), - ], + const SizedBox(height: 4), + Text( + descriptionText, + style: textTheme.bodyMedium, + textAlign: TextAlign.center, + ), + const SizedBox(height: 16), + Row( + children: [ + const Spacer( + flex: 3, + ), + Expanded( + flex: 4, + child: DurationInputField( + initialValue: _breakViewModel.submittedDuration, + onDurationChanged: onUpdateDuration, + ), + ), + const Spacer( + flex: 3, + ), + ], + ), + const SizedBox(height: 24), + TimeSelection( + key: ValueKey( + [_breakViewModel.startTime, _breakViewModel.endTime], + ), + // rebuild the widget when the start or end time changes + title: translations.pauseDialogPeriodTitle, + description: translations.pauseDialogPeriodDescription, + crossAxisAlignment: CrossAxisAlignment.center, + startTime: _breakViewModel.startTime, + endTime: _breakViewModel.endTime, + onStartChanged: onUpdateStart, + onEndChanged: onUpdateEnd, + ), + const SizedBox(height: 36), + saveButton, + SizedBox(height: spacing.bottomButtonPadding), + ], + ), ), ), ),