mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix: persist search page scroll offset between rebuilds (#22733)
fix: persist search scroll between rebuilds Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
6f3cb4f1bb
commit
b3342323de
5 changed files with 37 additions and 16 deletions
|
|
@ -40,6 +40,7 @@ class Timeline extends StatelessWidget {
|
|||
this.groupBy,
|
||||
this.withScrubber = true,
|
||||
this.snapToMonth = true,
|
||||
this.initialScrollOffset,
|
||||
});
|
||||
|
||||
final Widget? topSliverWidget;
|
||||
|
|
@ -51,6 +52,7 @@ class Timeline extends StatelessWidget {
|
|||
final GroupAssetsBy? groupBy;
|
||||
final bool withScrubber;
|
||||
final bool snapToMonth;
|
||||
final double? initialScrollOffset;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -78,6 +80,7 @@ class Timeline extends StatelessWidget {
|
|||
bottomSheet: bottomSheet,
|
||||
withScrubber: withScrubber,
|
||||
snapToMonth: snapToMonth,
|
||||
initialScrollOffset: initialScrollOffset,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -93,6 +96,7 @@ class _SliverTimeline extends ConsumerStatefulWidget {
|
|||
this.bottomSheet,
|
||||
this.withScrubber = true,
|
||||
this.snapToMonth = true,
|
||||
this.initialScrollOffset,
|
||||
});
|
||||
|
||||
final Widget? topSliverWidget;
|
||||
|
|
@ -101,6 +105,7 @@ class _SliverTimeline extends ConsumerStatefulWidget {
|
|||
final Widget? bottomSheet;
|
||||
final bool withScrubber;
|
||||
final bool snapToMonth;
|
||||
final double? initialScrollOffset;
|
||||
|
||||
@override
|
||||
ConsumerState createState() => _SliverTimelineState();
|
||||
|
|
@ -124,7 +129,10 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollController = ScrollController(onAttach: _restoreScalePosition);
|
||||
_scrollController = ScrollController(
|
||||
initialScrollOffset: widget.initialScrollOffset ?? 0.0,
|
||||
onAttach: _restoreScalePosition,
|
||||
);
|
||||
_eventSubscription = EventStream.shared.listen(_onEvent);
|
||||
|
||||
final currentTilesPerRow = ref.read(settingsProvider).get(Setting.tilesPerRow);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue