Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix empty state

vishnukvmd3719d175dbd4
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index 96fd57a5b3..c43e6156fa 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -261,6 +261,19 @@
"upload": "Upload",
"documentsHint": "Documents",
"searchHint": "Search...",
+ "searchEmptyTitle": "No matches found",
+ "searchEmptyDescription": "Try searching for something else.",
+ "searchEverywhereTitle": "Search everywhere for \"{query}\"",
+ "@searchEverywhereTitle": {
+ "description": "CTA title prompting the user to search globally",
+ "placeholders": {
+ "query": {
+ "type": "String",
+ "example": "passport"
+ }
+ }
+ },
+ "searchEverywhereSubtitle": "Search across all collections and files.",
"noCollectionsFoundForQuery": "No collections found for \"{query}\"",
"@noCollectionsFoundForQuery": {
"description": "Message when no collections match the search query",
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index 996b2dd3e4..bd17463d5e 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -616,6 +616,30 @@ abstract class AppLocalizations {
/// **'Search...'**
String get searchHint;
+ /// No description provided for @searchEmptyTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'No matches found'**
+ String get searchEmptyTitle;
+
+ /// No description provided for @searchEmptyDescription.
+ ///
+ /// In en, this message translates to:
+ /// **'Try searching for something else.'**
+ String get searchEmptyDescription;
+
+ /// CTA title prompting the user to search globally
+ ///
+ /// In en, this message translates to:
+ /// **'Search everywhere for \"{query}\"'**
+ String searchEverywhereTitle(String query);
+
+ /// No description provided for @searchEverywhereSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Search across all collections and files.'**
+ String get searchEverywhereSubtitle;
+
/// Message when no collections match the search query
///
/// In en, this message translates to:
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index 9cffaf8cfe..d57e3b9aa8 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -322,6 +322,21 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get searchHint => 'Search...';
+ @override
+ String get searchEmptyTitle => 'No matches found';
+
+ @override
+ String get searchEmptyDescription => 'Try searching for something else.';
+
+ @override
+ String searchEverywhereTitle(String query) {
+ return 'Search everywhere for \"$query\"';
+ }
+
+ @override
+ String get searchEverywhereSubtitle =>
+ 'Search across all collections and files.';
+
@override
String noCollectionsFoundForQuery(String query) {
return 'No collections found for \"$query\"';
diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dart
index 39b88bacd8..5cfaed5871 100644
--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart
+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart
@@ -12,6 +12,7 @@ import 'package:locker/services/files/sync/models/file.dart';
import 'package:locker/services/info_file_service.dart';
import "package:locker/ui/components/collection_list_widget.dart";
import "package:locker/ui/components/collection_row_widget.dart";
+import "package:locker/ui/components/empty_state_widget.dart";
import "package:locker/ui/components/file_list_widget.dart";
import "package:locker/ui/components/file_row_widget.dart";
import 'package:locker/ui/pages/collection_page.dart';
@@ -365,36 +366,22 @@ class FileListViewHelpers {
String? message,
}) {
return Center(
- child: Container(
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).backdropBase,
- borderRadius: BorderRadius.circular(12),
- ),
- padding: const EdgeInsets.all(32.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- "Oops!",
- style: getEnteTextTheme(context).largeBold,
- ),
- const SizedBox(height: 16),
- Text(
- 'Your search query do not match any results. Try searching something else',
- style: getEnteTextTheme(context).bodyMuted,
- textAlign: TextAlign.center,
- ),
- ],
- ),
+ child: EmptyStateWidget(
+ assetPath: 'assets/empty_state.png',
+ title: context.l10n.searchEmptyTitle,
+ subtitle: context.l10n.searchEmptyDescription,
+ showBorder: false,
),
);
}
static Widget createSearchEverywhereFooter({
+ required BuildContext context,
required String searchQuery,
required VoidCallback onTap,
- BuildContext? context,
}) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
return Container(
margin: const EdgeInsets.all(16.0),
child: Card(
@@ -408,9 +395,7 @@ class FileListViewHelpers {
children: [
Icon(
Icons.search,
- color: context != null
- ? Theme.of(context).primaryColor
- : Colors.blue,
+ color: colorScheme.primary700,
size: 24,
),
const SizedBox(width: 16),
@@ -419,36 +404,25 @@ class FileListViewHelpers {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'Search everywhere for "$searchQuery"',
- style: context != null
- ? getEnteTextTheme(context).large.copyWith(
- fontWeight: FontWeight.w500,
- color: Theme.of(context).primaryColor,
- )
- : const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.blue,
- ),
+ context.l10n.searchEverywhereTitle(searchQuery),
+ style: textTheme.large.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorScheme.primary700,
+ ),
),
const SizedBox(height: 4),
Text(
- 'Search across all collections and files',
- style: context != null
- ? getEnteTextTheme(context).body.copyWith(
- color: Colors.grey[600],
- )
- : TextStyle(
- fontSize: 14,
- color: Colors.grey[600],
- ),
+ context.l10n.searchEverywhereSubtitle,
+ style: textTheme.body.copyWith(
+ color: colorScheme.textMuted,
+ ),
),
],
),
),
Icon(
Icons.arrow_forward_ios,
- color: Colors.grey[400],
+ color: colorScheme.textMuted,
size: 16,
),
],
diff --git a/mobile/apps/locker/lib/ui/components/search_result_view.dart b/mobile/apps/locker/lib/ui/components/search_result_view.dart
index 7bd264980c..43e2d4e767 100644
--- a/mobile/apps/locker/lib/ui/components/search_result_view.dart
+++ b/mobile/apps/locker/lib/ui/components/search_result_view.dart
@@ -47,9 +47,9 @@ class SearchResultView extends StatelessWidget {
onSearchEverywhere != null &&
searchQuery.isNotEmpty)
FileListViewHelpers.createSearchEverywhereFooter(
+ context: context,
searchQuery: searchQuery,
onTap: onSearchEverywhere!,
- context: context,
),
],
),