mirror of
https://github.com/immich-app/immich.git
synced 2025-12-16 17:23:16 +03:00
fix: view in timeline does not jump to the timeline correctly (#23428)
This commit is contained in:
@@ -3,12 +3,14 @@ import 'dart:async';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/constants/constants.dart';
|
||||
import 'package:immich_mobile/entities/asset.entity.dart';
|
||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||
import 'package:immich_mobile/models/search/search_filter.model.dart';
|
||||
import 'package:immich_mobile/presentation/pages/search/paginated_search.provider.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_viewer.state.dart';
|
||||
import 'package:immich_mobile/providers/routes.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
|
||||
class SimilarPhotosActionButton extends ConsumerWidget {
|
||||
@@ -35,7 +37,21 @@ class SimilarPhotosActionButton extends ConsumerWidget {
|
||||
mediaType: AssetType.image,
|
||||
),
|
||||
);
|
||||
unawaited(context.router.popAndPush(const DriftSearchRoute()));
|
||||
|
||||
/// Using and currentTabIndex to make sure we are using the correct
|
||||
/// navigation behavior. We want to be able to navigate back to the
|
||||
/// main timline using View In Timeline button without the need of
|
||||
/// waiting for the timeline to be rebuild. At the same time, we want
|
||||
/// to refresh the search page when tapping the Similar Photos button
|
||||
/// while already in the Search tab.
|
||||
final currentTabIndex = (ref.read(currentTabIndexProvider.notifier).state);
|
||||
|
||||
if (currentTabIndex != kSearchTabIndex) {
|
||||
unawaited(context.router.navigate(const DriftSearchRoute()));
|
||||
ref.read(currentTabIndexProvider.notifier).state = kSearchTabIndex;
|
||||
} else {
|
||||
unawaited(context.router.popAndPush(const DriftSearchRoute()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -228,6 +228,8 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
||||
curve: Curves.easeInOut,
|
||||
)
|
||||
.whenComplete(() => ref.read(timelineStateProvider.notifier).setScrubbing(false));
|
||||
} else {
|
||||
ref.read(timelineStateProvider.notifier).setScrubbing(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user