Skip to content

High performance self-hosted photo and video management solution.

fix: remove drift map scrubber (#20723)

shenlongc5c9a522c1a4
diff --git a/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart b/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
index 0017621c39..19cce3392f 100644
--- a/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
+++ b/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
@@ -36,7 +36,7 @@ class _ScopedMapTimeline extends StatelessWidget {
return timelineService;
}),
],
- child: const Timeline(appBar: null, bottomSheet: null),
+ child: const Timeline(appBar: null, bottomSheet: null, withScrubber: false),
);
}
}
diff --git a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart
index b35aac59ee..c859ae0e80 100644
--- a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart
+++ b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart
@@ -36,6 +36,7 @@ class Timeline extends StatelessWidget {
this.appBar = const ImmichSliverAppBar(floating: true, pinned: false, snap: false),
this.bottomSheet = const GeneralBottomSheet(),
this.groupBy,
+ this.withScrubber = true,
});
final Widget? topSliverWidget;
@@ -45,6 +46,7 @@ class Timeline extends StatelessWidget {
final Widget? bottomSheet;
final bool withStack;
final GroupAssetsBy? groupBy;
+ final bool withScrubber;
@override
Widget build(BuildContext context) {
@@ -69,6 +71,7 @@ class Timeline extends StatelessWidget {
topSliverWidgetHeight: topSliverWidgetHeight,
appBar: appBar,
bottomSheet: bottomSheet,
+ withScrubber: withScrubber,
),
),
),
@@ -77,12 +80,19 @@ class Timeline extends StatelessWidget {
}
class _SliverTimeline extends ConsumerStatefulWidget {
- const _SliverTimeline({this.topSliverWidget, this.topSliverWidgetHeight, this.appBar, this.bottomSheet});
+ const _SliverTimeline({
+ this.topSliverWidget,
+ this.topSliverWidgetHeight,
+ this.appBar,
+ this.bottomSheet,
+ this.withScrubber = true,
+ });
final Widget? topSliverWidget;
final double? topSliverWidgetHeight;
final Widget? appBar;
final Widget? bottomSheet;
+ final bool withScrubber;
@override
ConsumerState createState() => _SliverTimelineState();
@@ -265,6 +275,45 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
const scrubberBottomPadding = 100.0;
final bottomPadding = context.padding.bottom + (widget.appBar == null ? 0 : scrubberBottomPadding);
+ final grid = CustomScrollView(
+ primary: true,
+ physics: _scrollPhysics,
+ cacheExtent: maxHeight * 2,
+ slivers: [
+ if (isSelectionMode) const SelectionSliverAppBar() else if (widget.appBar != null) widget.appBar!,
+ if (widget.topSliverWidget != null) widget.topSliverWidget!,
+ _SliverSegmentedList(
+ segments: segments,
+ delegate: SliverChildBuilderDelegate(
+ (ctx, index) {
+ if (index >= childCount) return null;
+ final segment = segments.findByIndex(index);
+ return segment?.builder(ctx, index) ?? const SizedBox.shrink();
+ },
+ childCount: childCount,
+ addAutomaticKeepAlives: false,
+ // We add repaint boundary around tiles, so skip the auto boundaries
+ addRepaintBoundaries: false,
+ ),
+ ),
+ const SliverPadding(padding: EdgeInsets.only(bottom: scrubberBottomPadding)),
+ ],
+ );
+
+ final Widget timeline;
+ if (widget.withScrubber) {
+ timeline = Scrubber(
+ layoutSegments: segments,
+ timelineHeight: maxHeight,
+ topPadding: topPadding,
+ bottomPadding: bottomPadding,
+ monthSegmentSnappingOffset: widget.topSliverWidgetHeight ?? 0 + appBarExpandedHeight,
+ child: grid,
+ );
+ } else {
+ timeline = grid;
+ }
+
return PrimaryScrollController(
controller: _scrollController,
child: RawGestureDetector(
@@ -303,40 +352,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
},
child: Stack(
children: [
- Scrubber(
- layoutSegments: segments,
- timelineHeight: maxHeight,
- topPadding: topPadding,
- bottomPadding: bottomPadding,
- monthSegmentSnappingOffset: widget.topSliverWidgetHeight ?? 0 + appBarExpandedHeight,
- child: CustomScrollView(
- primary: true,
- physics: _scrollPhysics,
- cacheExtent: maxHeight * 2,
- slivers: [
- if (isSelectionMode)
- const SelectionSliverAppBar()
- else if (widget.appBar != null)
- widget.appBar!,
- if (widget.topSliverWidget != null) widget.topSliverWidget!,
- _SliverSegmentedList(
- segments: segments,
- delegate: SliverChildBuilderDelegate(
- (ctx, index) {
- if (index >= childCount) return null;
- final segment = segments.findByIndex(index);
- return segment?.builder(ctx, index) ?? const SizedBox.shrink();
- },
- childCount: childCount,
- addAutomaticKeepAlives: false,
- // We add repaint boundary around tiles, so skip the auto boundaries
- addRepaintBoundaries: false,
- ),
- ),
- const SliverPadding(padding: EdgeInsets.only(bottom: scrubberBottomPadding)),
- ],
- ),
- ),
+ timeline,
if (!isSelectionMode && isMultiSelectEnabled) ...[
const Positioned(top: 60, left: 25, child: _MultiSelectStatusButton()),
if (widget.bottomSheet != null) widget.bottomSheet!,