mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
fix: handle back gesture in multi selection mode (#20356)
* fix: handle back gesture in multi selection mode # Conflicts: # mobile/lib/presentation/widgets/timeline/timeline.widget.dart * remove null-aware element because Isar * chore: set sqlite busy_timeout to 500ms (#20358) fix: add busy_timeout pragma Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
e52b9d15b5
commit
34974b036c
@ -109,6 +109,7 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
await customStatement('PRAGMA foreign_keys = ON');
|
await customStatement('PRAGMA foreign_keys = ON');
|
||||||
await customStatement('PRAGMA synchronous = NORMAL');
|
await customStatement('PRAGMA synchronous = NORMAL');
|
||||||
await customStatement('PRAGMA journal_mode = WAL');
|
await customStatement('PRAGMA journal_mode = WAL');
|
||||||
|
await customStatement('PRAGMA busy_timeout = 500');
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -155,11 +155,21 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
|||||||
final asyncSegments = ref.watch(timelineSegmentProvider);
|
final asyncSegments = ref.watch(timelineSegmentProvider);
|
||||||
final maxHeight = ref.watch(timelineArgsProvider.select((args) => args.maxHeight));
|
final maxHeight = ref.watch(timelineArgsProvider.select((args) => args.maxHeight));
|
||||||
final isSelectionMode = ref.watch(multiSelectProvider.select((s) => s.forceEnable));
|
final isSelectionMode = ref.watch(multiSelectProvider.select((s) => s.forceEnable));
|
||||||
|
final isMultiSelectEnabled = ref.watch(multiSelectProvider.select((s) => s.isEnabled));
|
||||||
|
|
||||||
return asyncSegments.widgetWhen(
|
return PopScope(
|
||||||
|
canPop: !isMultiSelectEnabled,
|
||||||
|
onPopInvokedWithResult: (_, __) {
|
||||||
|
if (isMultiSelectEnabled) {
|
||||||
|
ref.read(multiSelectProvider.notifier).reset();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: asyncSegments.widgetWhen(
|
||||||
onData: (segments) {
|
onData: (segments) {
|
||||||
final childCount = (segments.lastOrNull?.lastIndex ?? -1) + 1;
|
final childCount = (segments.lastOrNull?.lastIndex ?? -1) + 1;
|
||||||
final double appBarExpandedHeight = widget.appBar != null && widget.appBar is MesmerizingSliverAppBar ? 200 : 0;
|
final double appBarExpandedHeight = widget.appBar != null && widget.appBar is MesmerizingSliverAppBar
|
||||||
|
? 200
|
||||||
|
: 0;
|
||||||
final topPadding = context.padding.top + (widget.appBar == null ? 0 : kToolbarHeight) + 10;
|
final topPadding = context.padding.top + (widget.appBar == null ? 0 : kToolbarHeight) + 10;
|
||||||
|
|
||||||
const scrubberBottomPadding = 100.0;
|
const scrubberBottomPadding = 100.0;
|
||||||
@ -199,35 +209,15 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!isSelectionMode) ...[
|
if (!isSelectionMode && isMultiSelectEnabled) ...[
|
||||||
Consumer(
|
const Positioned(top: 60, left: 25, child: _MultiSelectStatusButton()),
|
||||||
builder: (_, consumerRef, child) {
|
if (widget.bottomSheet != null) widget.bottomSheet!,
|
||||||
final isMultiSelectEnabled = consumerRef.watch(multiSelectProvider.select((s) => s.isEnabled));
|
|
||||||
|
|
||||||
if (isMultiSelectEnabled) {
|
|
||||||
return child!;
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
child: const Positioned(top: 60, left: 25, child: _MultiSelectStatusButton()),
|
|
||||||
),
|
|
||||||
if (widget.bottomSheet != null)
|
|
||||||
Consumer(
|
|
||||||
builder: (_, consumerRef, child) {
|
|
||||||
final isMultiSelectEnabled = consumerRef.watch(multiSelectProvider.select((s) => s.isEnabled));
|
|
||||||
|
|
||||||
if (isMultiSelectEnabled) {
|
|
||||||
return child!;
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
child: widget.bottomSheet,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user