Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(mobile): search page minor enhancements #13403

Merged
merged 8 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added mobile/assets/polaroid-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/assets/polaroid-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions mobile/lib/models/search/search_filter.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ class SearchFilter {
AssetType? mediaType,
}) {
return SearchFilter(
context: context ?? this.context,
filename: filename ?? this.filename,
context: context,
filename: filename,
people: people ?? this.people,
location: location ?? this.location,
camera: camera ?? this.camera,
Expand Down
44 changes: 22 additions & 22 deletions mobile/lib/pages/common/tab_controller.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/providers/album/album.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/scroll_notifier.provider.dart';
import 'package:immich_mobile/providers/multiselect.provider.dart';
import 'package:immich_mobile/providers/search/search_input_focus.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/providers/asset.provider.dart';
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
Expand Down Expand Up @@ -44,21 +45,28 @@ class TabControllerPage extends HookConsumerWidget {
);
}

onNavigationSelected(TabsRouter router, int index) {
// On Photos page menu tapped
if (router.activeIndex == 0 && index == 0) {
scrollToTopNotifierProvider.scrollToTop();
}

// On Search page tapped
if (router.activeIndex == 1 && index == 1) {
ref.read(searchInputFocusProvider).requestFocus();
}

ref.read(hapticFeedbackProvider.notifier).selectionClick();
router.setActiveIndex(index);
ref.read(tabProvider.notifier).state = TabEnum.values[index];
}

navigationRail(TabsRouter tabsRouter) {
return NavigationRail(
labelType: NavigationRailLabelType.all,
selectedIndex: tabsRouter.activeIndex,
onDestinationSelected: (index) {
// Selected Photos while it is active
if (tabsRouter.activeIndex == 0 && index == 0) {
// Scroll to top
scrollToTopNotifierProvider.scrollToTop();
}

ref.read(hapticFeedbackProvider.notifier).selectionClick();
tabsRouter.setActiveIndex(index);
ref.read(tabProvider.notifier).state = TabEnum.values[index];
},
onDestinationSelected: (index) =>
onNavigationSelected(tabsRouter, index),
selectedIconTheme: IconThemeData(
color: context.primaryColor,
),
Expand Down Expand Up @@ -103,16 +111,8 @@ class TabControllerPage extends HookConsumerWidget {
bottomNavigationBar(TabsRouter tabsRouter) {
return NavigationBar(
selectedIndex: tabsRouter.activeIndex,
onDestinationSelected: (index) {
if (tabsRouter.activeIndex == 0 && index == 0) {
// Scroll to top
scrollToTopNotifierProvider.scrollToTop();
}

ref.read(hapticFeedbackProvider.notifier).selectionClick();
tabsRouter.setActiveIndex(index);
ref.read(tabProvider.notifier).state = TabEnum.values[index];
},
onDestinationSelected: (index) =>
onNavigationSelected(tabsRouter, index),
destinations: [
NavigationDestination(
label: 'tab_controller_nav_photos'.tr(),
Expand Down Expand Up @@ -171,7 +171,7 @@ class TabControllerPage extends HookConsumerWidget {
return AutoTabsRouter(
routes: [
const PhotosRoute(),
SearchInputRoute(),
SearchRoute(),
const AlbumsRoute(),
const LibraryRoute(),
],
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/pages/library/library.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class QuickAccessButtons extends ConsumerWidget {
colors: [
context.colorScheme.primary.withAlpha(10),
context.colorScheme.primary.withAlpha(15),
context.colorScheme.primary.withAlpha(20),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PlaceTile extends StatelessWidget {

void navigateToPlace() {
context.pushRoute(
SearchInputRoute(
SearchRoute(
prefilter: SearchFilter(
people: {},
location: SearchLocationFilter(
Expand Down
Loading
Loading