π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
make CTA icon and tile of album search section functional
ashilkn3171a7cd7c1f
diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dartindex f886424b2f..986eaf81ad 100644--- a/lib/models/search/search_types.dart+++ b/lib/models/search/search_types.dart@@ -1,10 +1,18 @@import "package:flutter/material.dart";+import "package:logging/logging.dart";import "package:photos/generated/l10n.dart";+import "package:photos/models/collection/collection.dart";+import "package:photos/models/collection/collection_items.dart";import "package:photos/models/search/search_result.dart";import "package:photos/models/typedefs.dart";+import "package:photos/services/collections_service.dart";import "package:photos/services/search_service.dart";+import "package:photos/ui/viewer/gallery/collection_page.dart";import "package:photos/ui/viewer/location/add_location_sheet.dart";import "package:photos/ui/viewer/location/pick_center_point_widget.dart";+import "package:photos/utils/dialog_util.dart";+import "package:photos/utils/navigation_util.dart";+import "package:photos/utils/share_util.dart";enum ResultType {collection,@@ -166,6 +174,12 @@ extension SectionTypeExtensions on SectionType {FutureVoidCallback ctaOnTap(BuildContext context) {switch (this) {+ case SectionType.people:+ return () async {+ shareText(+ S.of(context).shareTextRecommendUsingEnte,+ );+ };case SectionType.location:return () async {final centerPoint = await showPickCenterPointSheet(context);@@ -173,6 +187,39 @@ extension SectionTypeExtensions on SectionType {showAddLocationSheet(context, centerPoint);}};+ case SectionType.album:+ return () async {+ final result = await showTextInputDialog(+ context,+ title: S.of(context).newAlbum,+ submitButtonLabel: S.of(context).create,+ hintText: S.of(context).enterAlbumName,+ alwaysShowSuccessState: false,+ initialValue: "",+ textCapitalization: TextCapitalization.words,+ onSubmit: (String text) async {+ // indicates user cancelled the rename request+ if (text.trim() == "") {+ return;+ }+ try {+ final Collection c =+ await CollectionsService.instance.createAlbum(text);+ routeToPage(+ context,+ CollectionPage(CollectionWithThumbnail(c, null)),+ );+ } catch (e, s) {+ Logger("CreateNewAlbumIcon")+ .severe("Failed to create a new album", e, s);+ rethrow;+ }+ },+ );+ if (result is Exception) {+ showGenericErrorDialog(context: context);+ }+ };default:{return () async {};diff --git a/lib/ui/viewer/search/search_section_cta.dart b/lib/ui/viewer/search/search_section_cta.dartindex 21e06850dc..b48dee4dab 100644--- a/lib/ui/viewer/search/search_section_cta.dart+++ b/lib/ui/viewer/search/search_section_cta.dart@@ -72,34 +72,37 @@ class SearchSectionCTATile extends StatelessWidget {final textTheme = getEnteTextTheme(context);return Padding(padding: const EdgeInsets.only(right: 1),- child: DottedBorder(- strokeWidth: 2,- borderType: BorderType.RRect,- radius: const Radius.circular(4),- padding: EdgeInsets.zero,- dashPattern: const [4, 4],- color: colorScheme.strokeFainter,- child: Row(- children: [- Container(- width: 60,- height: 60,- decoration: BoxDecoration(- borderRadius:- const BorderRadius.horizontal(left: Radius.circular(4)),- color: colorScheme.fillFaint,+ child: GestureDetector(+ onTap: sectionType.ctaOnTap(context),+ child: DottedBorder(+ strokeWidth: 2,+ borderType: BorderType.RRect,+ radius: const Radius.circular(4),+ padding: EdgeInsets.zero,+ dashPattern: const [4, 4],+ color: colorScheme.strokeFainter,+ child: Row(+ children: [+ Container(+ width: 60,+ height: 60,+ decoration: BoxDecoration(+ borderRadius:+ const BorderRadius.horizontal(left: Radius.circular(4)),+ color: colorScheme.fillFaint,+ ),+ child: Icon(+ sectionType.getCTAIcon(),+ color: colorScheme.strokeMuted,+ ),),- child: Icon(- sectionType.getCTAIcon(),- color: colorScheme.strokeMuted,+ const SizedBox(width: 12),+ Text(+ sectionType.getCTAText(context),+ style: textTheme.body,),- ),- const SizedBox(width: 12),- Text(- sectionType.getCTAText(context),- style: textTheme.body,- ),- ],+ ],+ ),),),);