Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

album search bar on album tab

laurenspriem5cc73fb95813
diff --git a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
index 6ab9251b6d..1b86acc9c6 100644
--- a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
+++ b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
@@ -30,6 +30,7 @@ class CollectionListPage extends StatefulWidget {
final double? initialScrollOffset;
final String tag;
final UISectionType sectionType;
+ final bool startInSearchMode;
const CollectionListPage(
this.collections, {
@@ -37,6 +38,7 @@ class CollectionListPage extends StatefulWidget {
this.appTitle,
this.initialScrollOffset,
this.tag = "",
+ this.startInSearchMode = false,
super.key,
});
@@ -101,6 +103,7 @@ class _CollectionListPageState extends State<CollectionListPage> {
SearchableAppBar(
title: widget.appTitle ?? const SizedBox.shrink(),
heroTag: widget.tag,
+ autoActivateSearch: widget.startInSearchMode,
onSearch: (value) {
setState(() {
_searchQuery = value;
diff --git a/mobile/apps/photos/lib/ui/components/searchable_appbar.dart b/mobile/apps/photos/lib/ui/components/searchable_appbar.dart
index bf447a952d..f12e2ff8b8 100644
--- a/mobile/apps/photos/lib/ui/components/searchable_appbar.dart
+++ b/mobile/apps/photos/lib/ui/components/searchable_appbar.dart
@@ -8,6 +8,7 @@ class SearchableAppBar extends StatefulWidget {
final Function(String) onSearch;
final VoidCallback? onSearchClosed;
final String heroTag;
+ final bool autoActivateSearch;
const SearchableAppBar({
super.key,
@@ -16,6 +17,7 @@ class SearchableAppBar extends StatefulWidget {
required this.onSearch,
this.onSearchClosed,
this.heroTag = "",
+ this.autoActivateSearch = false,
});
@override
@@ -27,6 +29,28 @@ class _SearchableAppBarState extends State<SearchableAppBar> {
final TextEditingController _searchController = TextEditingController();
final FocusNode _searchFocusNode = FocusNode();
+ @override
+ void initState() {
+ super.initState();
+ if (widget.autoActivateSearch) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ _activateSearch();
+ });
+ }
+ }
+
+ @override
+ void didUpdateWidget(covariant SearchableAppBar oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (widget.autoActivateSearch &&
+ !oldWidget.autoActivateSearch &&
+ !_isSearchActive) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ _activateSearch();
+ });
+ }
+ }
+
@override
void dispose() {
_searchController.dispose();
diff --git a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart b/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart
index 0d0f4dd072..0904724457 100644
--- a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart
@@ -126,6 +126,7 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
.color!
.withValues(alpha: 0.5),
);
+ final colorScheme = getEnteColorScheme(context);
return Stack(
alignment: Alignment.bottomCenter,
@@ -158,7 +159,7 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
trailingWidget: IconButtonWidget(
icon: Icons.chevron_right,
iconButtonType: IconButtonType.secondary,
- iconColor: getEnteColorScheme(context).blurStrokePressed,
+ iconColor: colorScheme.blurStrokePressed,
),
),
),
@@ -180,10 +181,35 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
);
},
SectionTitle(titleWithBrand: getOnEnteSection(context)),
- trailingWidget: IconButtonWidget(
- icon: Icons.chevron_right,
- iconButtonType: IconButtonType.secondary,
- iconColor: getEnteColorScheme(context).blurStrokePressed,
+ trailingWidget: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ IconButtonWidget(
+ icon: Icons.search,
+ iconButtonType: IconButtonType.secondary,
+ iconColor: colorScheme.blurStrokePressed,
+ onTap: () {
+ unawaited(
+ routeToPage(
+ context,
+ CollectionListPage(
+ collections,
+ sectionType: UISectionType.homeCollections,
+ appTitle: SectionTitle(
+ titleWithBrand: getOnEnteSection(context),
+ ),
+ startInSearchMode: true,
+ ),
+ ),
+ );
+ },
+ ),
+ IconButtonWidget(
+ icon: Icons.chevron_right,
+ iconButtonType: IconButtonType.secondary,
+ iconColor: colorScheme.blurStrokePressed,
+ ),
+ ],
),
),
),
@@ -200,7 +226,7 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>
: const SliverToBoxAdapter(child: EmptyState()),
SliverToBoxAdapter(
child: Divider(
- color: getEnteColorScheme(context).strokeFaint,
+ color: colorScheme.strokeFaint,
),
),
const SliverToBoxAdapter(child: SizedBox(height: 12)),