π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
empty states for each section
ashilknb9692f8e3cb8
diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dartindex 986eaf81ad..6d5d853be1 100644--- a/lib/models/search/search_types.dart+++ b/lib/models/search/search_types.dart@@ -110,6 +110,27 @@ extension SectionTypeExtensions on SectionType {// isCTAVisible is used to show/hide the CTA button in the empty state// Disable the CTA for face, content, moment, fileTypesAndExtension, fileCaptionbool get isCTAVisible {+ switch (this) {+ case SectionType.face:+ return false;+ case SectionType.content:+ return false;+ case SectionType.moment:+ return false;+ case SectionType.location:+ return true;+ case SectionType.people:+ return true;+ case SectionType.album:+ return true;+ case SectionType.fileTypesAndExtension:+ return false;+ case SectionType.fileCaption:+ return false;+ }+ }++ bool get isEmptyCTAVisible {switch (this) {case SectionType.face:return true;diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dartindex 5eaec140e8..794b5bc7fe 100644--- a/lib/ui/viewer/search/search_section.dart+++ b/lib/ui/viewer/search/search_section.dart@@ -30,47 +30,75 @@ class SearchSection extends StatelessWidget {Widget build(BuildContext context) {debugPrint("Building section for ${sectionType.name}");final textTheme = getEnteTextTheme(context);- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- Padding(- padding: const EdgeInsets.all(12),- child: Text(- sectionType.sectionTitle(context),- style: textTheme.largeBold,- ),- ),- examples.length < (limit - 1)- ? const SizedBox.shrink()- : GestureDetector(- onTap: () {- routeToPage(- context,- SearchSectionResultPage(sectionType: sectionType),- );- },- child: Padding(+ return Padding(+ padding: const EdgeInsets.symmetric(vertical: 8),+ child: examples.isNotEmpty+ ? Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ Padding(padding: const EdgeInsets.all(12),- child: Icon(- Icons.chevron_right_outlined,- color: getEnteColorScheme(context).strokeMuted,+ child: Text(+ sectionType.sectionTitle(context),+ style: textTheme.largeBold,+ ),+ ),+ examples.length < (limit - 1)+ ? const SizedBox.shrink()+ : GestureDetector(+ onTap: () {+ routeToPage(+ context,+ SearchSectionResultPage(+ sectionType: sectionType,+ ),+ );+ },+ child: Padding(+ padding: const EdgeInsets.all(12),+ child: Icon(+ Icons.chevron_right_outlined,+ color: getEnteColorScheme(context).strokeMuted,+ ),+ ),+ ),+ ],+ ),+ const SizedBox(height: 2),+ SearchExampleRow(examples, sectionType),+ ],+ )+ : Padding(+ padding: const EdgeInsets.only(left: 16, right: 8),+ child: Row(+ children: [+ Expanded(+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 12),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ sectionType.sectionTitle(context),+ style: textTheme.largeBold,+ ),+ const SizedBox(height: 24),+ Text(+ sectionType.getEmptyStateText(context),+ style: textTheme.smallMuted,+ ),+ ],),),),- ],- ),- const SizedBox(height: 2),- // wrap below text in next line- // Text(- // sectionType.getEmptyStateText(context),- // style: textTheme.smallMuted,- // softWrap: true,- // ),- SearchExampleRow(examples, sectionType),- ],+ const SizedBox(width: 8),+ SearchSectionEmptyCTAIcon(sectionType),+ ],+ ),+ ),);}}diff --git a/lib/ui/viewer/search/search_section_cta.dart b/lib/ui/viewer/search/search_section_cta.dartindex e3219747a9..4a4e43f9d4 100644--- a/lib/ui/viewer/search/search_section_cta.dart+++ b/lib/ui/viewer/search/search_section_cta.dart@@ -57,3 +57,53 @@ class SearchSectionCTAIcon extends StatelessWidget {);}}++class SearchSectionEmptyCTAIcon extends StatelessWidget {+ final SectionType sectionType;+ const SearchSectionEmptyCTAIcon(this.sectionType, {super.key});++ @override+ Widget build(BuildContext context) {+ if (sectionType.isCTAVisible == false) {+ return const SizedBox(height: 115);+ }+ final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);+ return GestureDetector(+ onTap: sectionType.ctaOnTap(context),+ child: Padding(+ padding: const EdgeInsets.fromLTRB(8, 24, 8, 0),+ child: Column(+ children: [+ DottedBorder(+ color: colorScheme.strokeFaint,+ dashPattern: const [3.875, 3.875],+ borderType: BorderType.Circle,+ strokeWidth: 1.5,+ radius: const Radius.circular(33.25),+ child: SizedBox(+ width: 62.5,+ height: 62.5,+ child: Icon(+ sectionType.getCTAIcon() ?? Icons.add,+ color: colorScheme.strokeFaint,+ size: 20,+ ),+ ),+ ),+ const SizedBox(+ height: 10,+ ),+ Text(+ sectionType.getCTAText(context),+ maxLines: 2,+ textAlign: TextAlign.center,+ overflow: TextOverflow.ellipsis,+ style: textTheme.miniFaint,+ ),+ ],+ ),+ ),+ );+ }+}