fix: collection pane scroll padding

This commit is contained in:
DenserMeerkat
2024-06-13 00:56:17 +05:30
parent 04f763eca5
commit 605afefd9f
3 changed files with 102 additions and 90 deletions

View File

@ -109,14 +109,21 @@ const kP8CollectionPane = EdgeInsets.only(
//right: 4.0, //right: 4.0,
// bottom: 8.0, // bottom: 8.0,
); );
const kPt28 = EdgeInsets.only(top: 28); const kPt28 = EdgeInsets.only(
const kPt32 = EdgeInsets.only(top: 32); top: 28,
);
const kPt32 = EdgeInsets.only(
top: 32,
);
const kPb10 = EdgeInsets.only( const kPb10 = EdgeInsets.only(
bottom: 10, bottom: 10,
); );
const kPb15 = EdgeInsets.only( const kPb15 = EdgeInsets.only(
bottom: 15, bottom: 15,
); );
const kPb70 = EdgeInsets.only(
bottom: 70,
);
const kHSpacer4 = SizedBox(width: 4); const kHSpacer4 = SizedBox(width: 4);
const kHSpacer5 = SizedBox(width: 5); const kHSpacer5 = SizedBox(width: 5);
const kHSpacer10 = SizedBox(width: 10); const kHSpacer10 = SizedBox(width: 10);

View File

@ -22,92 +22,101 @@ class CollectionPane extends ConsumerWidget {
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
); );
} }
return Padding( return Drawer(
padding: kIsMacOS ? kP24CollectionPane : kP8CollectionPane, shape: const ContinuousRectangleBorder(),
child: Column( backgroundColor: Theme.of(context).colorScheme.surface,
crossAxisAlignment: CrossAxisAlignment.stretch, surfaceTintColor: kColorTransparent,
children: [ child: Padding(
Padding( padding: (!context.isMediumWindow && kIsMacOS
padding: kPe8, ? kP24CollectionPane
child: Wrap( : kP8CollectionPane) +
alignment: WrapAlignment.spaceBetween, (context.isMediumWindow ? kPb70 : EdgeInsets.zero),
children: [ child: Column(
TextButton.icon( crossAxisAlignment: CrossAxisAlignment.stretch,
onPressed: (savingData || !hasUnsavedChanges) children: [
? null Padding(
: () async { padding: kPe8,
overlayWidget.show( child: Wrap(
widget: alignment: WrapAlignment.spaceBetween,
const SavingOverlay(saveCompleted: false)); children: [
TextButton.icon(
onPressed: (savingData || !hasUnsavedChanges)
? null
: () async {
overlayWidget.show(
widget:
const SavingOverlay(saveCompleted: false));
await ref await ref
.read(collectionStateNotifierProvider.notifier) .read(collectionStateNotifierProvider.notifier)
.saveData(); .saveData();
overlayWidget.hide(); overlayWidget.hide();
overlayWidget.show( overlayWidget.show(
widget: const SavingOverlay(saveCompleted: true)); widget:
await Future.delayed(const Duration(seconds: 1)); const SavingOverlay(saveCompleted: true));
overlayWidget.hide(); await Future.delayed(const Duration(seconds: 1));
}, overlayWidget.hide();
icon: const Icon( },
Icons.save, icon: const Icon(
size: 20, Icons.save,
size: 20,
),
label: const Text(
kLabelSave,
style: kTextStyleButton,
),
), ),
label: const Text( //const Spacer(),
kLabelSave, ElevatedButton(
style: kTextStyleButton, 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( kVSpacer10,
children: [ Container(
kHSpacer5, margin: const EdgeInsets.only(right: 8),
Icon( decoration: BoxDecoration(
Icons.filter_alt, borderRadius: kBorderRadius8,
size: 18, border: Border.all(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.surfaceVariant,
), ),
kHSpacer5, ),
Expanded( child: Row(
child: RawTextField( children: [
style: Theme.of(context).textTheme.bodyMedium, kHSpacer5,
hintText: "Filter by name or URL", Icon(
onChanged: (value) { Icons.filter_alt,
ref.read(collectionSearchQueryProvider.notifier).state = size: 18,
value.toLowerCase(); 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,
kVSpacer10, const Expanded(
const Expanded( child: RequestList(),
child: RequestList(), ),
), kVSpacer5
kVSpacer5 ],
], ),
), ),
); );
} }

View File

@ -39,16 +39,12 @@ class PageBase extends ConsumerWidget {
); );
return Stack( return Stack(
children: [ children: [
!context.isCompactWindow Container(
? Row( padding: (context.isMediumWindow ? kPb70 : EdgeInsets.zero) +
children: [ (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero),
const NavRail(), color: Theme.of(context).colorScheme.surface,
Expanded( child: scaffold,
child: scaffold, ),
),
],
)
: scaffold,
if (kIsWindows) if (kIsWindows)
SizedBox( SizedBox(
height: 29, height: 29,