π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Show query suggestions on UI when no result is found
ashilkn3b6294b64cef
diff --git a/lib/ui/viewer/search/result/no_result_widget.dart b/lib/ui/viewer/search/result/no_result_widget.dartindex 9f7cc0b9dd..15d9193fe1 100644--- a/lib/ui/viewer/search/result/no_result_widget.dart+++ b/lib/ui/viewer/search/result/no_result_widget.dart@@ -1,5 +1,6 @@import 'package:flutter/material.dart';import "package:photos/models/search/search_types.dart";+import "package:photos/theme/ente_theme.dart";import "package:photos/ui/search_tab.dart";class NoResultWidget extends StatefulWidget {@@ -34,6 +35,68 @@ class _NoResultWidgetState extends State<NoResultWidget> {@overrideWidget build(BuildContext context) {- return const SizedBox.shrink();+ final textTheme = getEnteTextTheme(context);+ final examples = <Widget>[];+ searchTypeToSearchSuggestion.forEach(+ (key, value) {+ examples.add(+ Row(+ children: [+ Text(+ key,+ style: textTheme.bodyMuted,+ ),+ const SizedBox(width: 6),+ Text(+ formatList(value),+ style: textTheme.miniMuted,+ ),+ ],+ ),+ );+ },+ );+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 32),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ // S.of(context).noResults,+ "No results found",+ style: textTheme.largeBold,+ ),+ const SizedBox(height: 6),+ Text(+ "Modify your query, or try searching for",+ style: textTheme.smallMuted,+ ),+ ],+ ),+ const SizedBox(height: 20),+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 4),+ child: ListView.separated(+ itemBuilder: (context, index) {+ return examples[index];+ },+ separatorBuilder: (context, index) {+ return const SizedBox(height: 12);+ },+ itemCount: searchTypeToSearchSuggestion.length,+ shrinkWrap: true,+ ),+ ),+ ],+ ),+ );+ }++ String formatList(List<String> strings) {+ // Join the strings with ', ' and wrap each element with double quotes+ return strings.map((str) => '"$str"').join(', ');}}