From 605afefd9f1041be32e709fbaa810cde4f961992 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Thu, 13 Jun 2024 00:56:17 +0530 Subject: [PATCH] fix: collection pane scroll padding --- lib/consts.dart | 11 +- lib/screens/home_page/collection_pane.dart | 165 +++++++++++---------- lib/screens/mobile/widgets/page_base.dart | 16 +- 3 files changed, 102 insertions(+), 90 deletions(-) diff --git a/lib/consts.dart b/lib/consts.dart index bd5d2185..bdeba288 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -109,14 +109,21 @@ const kP8CollectionPane = EdgeInsets.only( //right: 4.0, // bottom: 8.0, ); -const kPt28 = EdgeInsets.only(top: 28); -const kPt32 = EdgeInsets.only(top: 32); +const kPt28 = EdgeInsets.only( + top: 28, +); +const kPt32 = EdgeInsets.only( + top: 32, +); const kPb10 = EdgeInsets.only( bottom: 10, ); const kPb15 = EdgeInsets.only( bottom: 15, ); +const kPb70 = EdgeInsets.only( + bottom: 70, +); const kHSpacer4 = SizedBox(width: 4); const kHSpacer5 = SizedBox(width: 5); const kHSpacer10 = SizedBox(width: 10); diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index 9b193b6f..822af01c 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -22,92 +22,101 @@ class CollectionPane extends ConsumerWidget { child: CircularProgressIndicator(), ); } - return Padding( - padding: kIsMacOS ? kP24CollectionPane : kP8CollectionPane, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: kPe8, - child: Wrap( - alignment: WrapAlignment.spaceBetween, - children: [ - TextButton.icon( - onPressed: (savingData || !hasUnsavedChanges) - ? null - : () async { - overlayWidget.show( - widget: - const SavingOverlay(saveCompleted: false)); + return Drawer( + shape: const ContinuousRectangleBorder(), + backgroundColor: Theme.of(context).colorScheme.surface, + surfaceTintColor: kColorTransparent, + child: Padding( + padding: (!context.isMediumWindow && kIsMacOS + ? kP24CollectionPane + : kP8CollectionPane) + + (context.isMediumWindow ? kPb70 : EdgeInsets.zero), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: kPe8, + child: Wrap( + alignment: WrapAlignment.spaceBetween, + children: [ + TextButton.icon( + onPressed: (savingData || !hasUnsavedChanges) + ? null + : () async { + overlayWidget.show( + widget: + const SavingOverlay(saveCompleted: false)); - await ref - .read(collectionStateNotifierProvider.notifier) - .saveData(); - overlayWidget.hide(); - overlayWidget.show( - widget: const SavingOverlay(saveCompleted: true)); - await Future.delayed(const Duration(seconds: 1)); - overlayWidget.hide(); - }, - icon: const Icon( - Icons.save, - size: 20, + await ref + .read(collectionStateNotifierProvider.notifier) + .saveData(); + overlayWidget.hide(); + overlayWidget.show( + widget: + const SavingOverlay(saveCompleted: true)); + await Future.delayed(const Duration(seconds: 1)); + overlayWidget.hide(); + }, + icon: const Icon( + Icons.save, + size: 20, + ), + label: const Text( + kLabelSave, + style: kTextStyleButton, + ), ), - label: const Text( - kLabelSave, - style: kTextStyleButton, + //const Spacer(), + ElevatedButton( + onPressed: () { + ref.read(collectionStateNotifierProvider.notifier).add(); + }, + child: const Text( + kLabelPlusNew, + style: kTextStyleButton, + ), ), - ), - //const Spacer(), - ElevatedButton( - onPressed: () { - ref.read(collectionStateNotifierProvider.notifier).add(); - }, - child: const Text( - kLabelPlusNew, - style: kTextStyleButton, - ), - ), - ], - ), - ), - kVSpacer10, - Container( - margin: const EdgeInsets.only(right: 8), - decoration: BoxDecoration( - borderRadius: kBorderRadius8, - border: Border.all( - color: Theme.of(context).colorScheme.surfaceVariant, + ], ), ), - child: Row( - children: [ - kHSpacer5, - Icon( - Icons.filter_alt, - size: 18, - color: Theme.of(context).colorScheme.secondary, + kVSpacer10, + Container( + margin: const EdgeInsets.only(right: 8), + decoration: BoxDecoration( + borderRadius: kBorderRadius8, + border: Border.all( + color: Theme.of(context).colorScheme.surfaceVariant, ), - kHSpacer5, - Expanded( - child: RawTextField( - style: Theme.of(context).textTheme.bodyMedium, - hintText: "Filter by name or URL", - onChanged: (value) { - ref.read(collectionSearchQueryProvider.notifier).state = - value.toLowerCase(); - }, + ), + child: Row( + children: [ + kHSpacer5, + Icon( + Icons.filter_alt, + size: 18, + color: Theme.of(context).colorScheme.secondary, ), - ), - ], + kHSpacer5, + Expanded( + child: RawTextField( + style: Theme.of(context).textTheme.bodyMedium, + hintText: "Filter by name or URL", + onChanged: (value) { + ref.read(collectionSearchQueryProvider.notifier).state = + value.toLowerCase(); + }, + ), + ), + ], + ), ), - ), - kVSpacer10, - const Expanded( - child: RequestList(), - ), - kVSpacer5 - ], + kVSpacer10, + const Expanded( + child: RequestList(), + ), + kVSpacer5 + ], + ), ), ); } diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index 6df5a566..3116e2d7 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -39,16 +39,12 @@ class PageBase extends ConsumerWidget { ); return Stack( children: [ - !context.isCompactWindow - ? Row( - children: [ - const NavRail(), - Expanded( - child: scaffold, - ), - ], - ) - : scaffold, + Container( + padding: (context.isMediumWindow ? kPb70 : EdgeInsets.zero) + + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), + color: Theme.of(context).colorScheme.surface, + child: scaffold, + ), if (kIsWindows) SizedBox( height: 29,