π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Extend album covers and Hero transitions to people
r4khul97428038b050
diff --git a/mobile/apps/photos/lib/models/search/search_types.dart b/mobile/apps/photos/lib/models/search/search_types.dartindex a12790e89d..e18eccb2f7 100644--- a/mobile/apps/photos/lib/models/search/search_types.dart+++ b/mobile/apps/photos/lib/models/search/search_types.dart@@ -254,6 +254,7 @@ extension SectionTypeExtensions on SectionType {case SectionType.face:return SearchService.instance.getAllFace(limit,+ coverHeroTagPrefix: "people_discover",minClusterSize: limit == null? kMinimumClusterSizeAllFaces: kMinimumClusterSizeSearchResult,diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dartindex 386ee97d77..ad022dc57f 100644--- a/mobile/apps/photos/lib/services/search_service.dart+++ b/mobile/apps/photos/lib/services/search_service.dart@@ -61,6 +61,7 @@ import "package:photos/states/location_screen_state.dart";import "package:photos/ui/viewer/location/location_screen.dart";import "package:photos/ui/viewer/people/cluster_page.dart";import "package:photos/ui/viewer/people/people_page.dart";+import "package:photos/ui/viewer/people/person_face_widget.dart";import "package:photos/ui/viewer/search/result/magic_result_screen.dart";import "package:photos/utils/cache_util.dart";import "package:photos/utils/people_sort_util.dart";@@ -1308,6 +1309,7 @@ class SearchService {int? fallbackMinClusterSize,bool showIgnoredOnly = false,bool includeEmptyPersons = false,+ String coverHeroTagPrefix = "people_search",}) async {try {if (isLocalGalleryMode) {@@ -1366,9 +1368,14 @@ class SearchService {ClusterPage(files,tagPrefix: "${ResultType.faces.toString()}_$clusterId",+ coverHeroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: coverHeroTagPrefix,+ clusterID: clusterId,+ ),clusterID: clusterId,showNamingBanner: false,),+ useFadeTransition: true,);},hierarchicalSearchFilter: FaceFilter(@@ -1512,6 +1519,10 @@ class SearchService {ctx,PeoplePage(tagPrefix: "${ResultType.faces.toString()}_${p.data.name}",+ coverHeroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: coverHeroTagPrefix,+ personId: p.remoteID,+ ),person: p,searchResult: GenericSearchResult(ResultType.faces,@@ -1528,6 +1539,7 @@ class SearchService {),),),+ useFadeTransition: true,);},hierarchicalSearchFilter: FaceFilter(@@ -1592,8 +1604,13 @@ class SearchService {ClusterPage(files,tagPrefix: "${ResultType.faces.toString()}_$clusterName",+ coverHeroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: coverHeroTagPrefix,+ clusterID: clusterId,+ ),clusterID: clusterId,),+ useFadeTransition: true,);},hierarchicalSearchFilter: FaceFilter(@@ -1616,6 +1633,7 @@ class SearchService {minClusterSize: fallbackMinClusterSize,showIgnoredOnly: showIgnoredOnly,includeEmptyPersons: includeEmptyPersons,+ coverHeroTagPrefix: coverHeroTagPrefix,);} else {return [];diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dartindex d3a3e5baf8..3ae0db27a9 100644--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart@@ -20,29 +20,40 @@ import "package:photos/service_locator.dart" show isLocalGalleryMode;import 'package:photos/services/collections_service.dart';import "package:photos/services/machine_learning/face_ml/feedback/cluster_feedback.dart";import "package:photos/services/machine_learning/ml_result.dart";-import "package:photos/theme/ente_theme.dart";import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';import 'package:photos/ui/components/buttons/button_widget.dart';import 'package:photos/ui/sharing/share_person_sheet.dart';import "package:photos/ui/viewer/gallery/gallery_app_bar_actions.dart";import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";+import "package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart";import 'package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart';import "package:photos/ui/viewer/people/cluster_breakup_page.dart";import "package:photos/ui/viewer/people/cluster_page.dart";+import "package:photos/ui/viewer/people/person_face_widget.dart";import "package:photos/utils/dialog_util.dart";class ClusterAppBar extends StatefulWidget {- static const double _sliverExpandedHeight = 92.0;-static GalleryAppBarConfig sliverConfig(GalleryType type,String? title,SelectedFiles selectedFiles,String clusterID, {+ required List<EnteFile> files,+ Key? coverAppBarKey,+ String? coverHeroTag,bool memoryLaneReady = false,Future<void> Function()? onMemoryLaneTap,}) {+ final config = GalleryAppBarWidget.sliverConfig(+ type,+ title,+ selectedFiles,+ coverWidget: files.isEmpty+ ? null+ : PersonFaceWidget(clusterID: clusterID),+ );return GalleryAppBarConfig(+ extendBodyForCollapse: config.extendBodyForCollapse,sliverBuilder: (_) => ClusterAppBar._(type,title,@@ -50,15 +61,17 @@ class ClusterAppBar extends StatefulWidget {clusterID,memoryLaneReady,onMemoryLaneTap,+ files,+ coverAppBarKey,+ coverHeroTag,),- geometryBuilder: (context) => SliverAppBarComponent.resolveGeometry(- context,- expandedHeight: _sliverExpandedHeight,- collapsedHeight: kToolbarHeight,- ),+ geometryBuilder: config.geometryBuilder,);}+ final List<EnteFile> files;+ final Key? coverAppBarKey;+ final String? coverHeroTag;final GalleryType type;final String? title;final SelectedFiles selectedFiles;@@ -73,6 +86,9 @@ class ClusterAppBar extends StatefulWidget {this.clusterID,this.memoryLaneReady,this.onMemoryLaneTap,+ this.files,+ this.coverAppBarKey,+ this.coverHeroTag,);@override@@ -132,16 +148,51 @@ class _AppBarWidgetState extends State<ClusterAppBar> {@overrideWidget build(BuildContext context) {- return SliverAppBarComponent(- title: _appBarTitle ?? "",- actions: _getDefaultActions(context),- expandedHeight: ClusterAppBar._sliverExpandedHeight,- collapsedHeight: kToolbarHeight,- backgroundColor: getEnteColorScheme(context).backgroundColour,- );+ final currentUserID = Configuration.instance.getUserID();+ final shareableFiles =+ widget.selectedFiles.files.isEmpty &&+ !isLocalGalleryMode &&+ Configuration.instance.hasConfiguredAccount()+ ? GalleryFilesState.maybeOf(context)?.galleryFilesOrNull+ ?.where(+ (file) =>+ file.uploadedFileID != null &&+ file.ownerID == currentUserID,+ )+ .toList()+ : null;+ return GalleryAppBarWidget.sliverConfig(+ widget.type,+ _appBarTitle,+ widget.selectedFiles,+ files: widget.files,+ coverAppBarKey: widget.coverAppBarKey,+ coverWidget: widget.files.isEmpty+ ? null+ : PersonFaceWidget(+ clusterID: widget.clusterID,+ cachedPixelWidth:+ (MediaQuery.sizeOf(context).width *+ MediaQuery.devicePixelRatioOf(context))+ .ceil(),+ ),+ coverHeroTag: widget.coverHeroTag,+ actionsBuilder: ({required onCover, foregroundColor}) =>+ _getDefaultActions(+ context,+ onCover: onCover,+ foregroundColor: foregroundColor,+ shareableFiles: shareableFiles,+ ),+ ).buildSliver(context);}- List<Widget> _getDefaultActions(BuildContext context) {+ List<Widget> _getDefaultActions(+ BuildContext context, {+ required bool onCover,+ Color? foregroundColor,+ required List<EnteFile>? shareableFiles,+ }) {final hasAccount = Configuration.instance.hasConfiguredAccount();final List<Widget> actions = <Widget>[];if (widget.selectedFiles.files.isNotEmpty) {@@ -149,24 +200,24 @@ class _AppBarWidgetState extends State<ClusterAppBar> {}if (!isLocalGalleryMode && hasAccount) {- final currentUserID = Configuration.instance.getUserID();- final files = GalleryFilesState.maybeOf(context)?.galleryFilesOrNull- ?.where(- (file) =>- file.uploadedFileID != null && file.ownerID == currentUserID,- )- .toList();- if (files != null && files.isNotEmpty) {+ if (shareableFiles != null && shareableFiles.isNotEmpty) {actions.add(IconButtonComponent(key: shareButtonKey,- icon: const HugeIcon(icon: HugeIcons.strokeRoundedShare08),- variant: IconButtonComponentVariant.primary,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedShare08,+ color: foregroundColor,+ ),+ variant: onCover+ ? IconButtonComponentVariant.unfilled+ : IconButtonComponentVariant.primary,+ size: onCover ? kMinInteractiveDimension : 36,+ iconSize: onCover ? IconSizes.medium : IconSizes.small,tooltip: context.strings.share,shouldSurfaceExecutionStates: false,onTap: () => showSharePersonSheet(context,- files: files,+ files: shareableFiles,shareButtonKey: shareButtonKey,),),@@ -214,10 +265,16 @@ class _AppBarWidgetState extends State<ClusterAppBar> {];if (items.isEmpty) return actions;+ final overflowMenuAction = onCover+ ? galleryAppBarActionsSheetAction+ : galleryAppBarPopupMenuAction;actions.add(- galleryAppBarPopupMenuAction<ClusterPopupAction>(+ overflowMenuAction<ClusterPopupAction>(tooltip: context.strings.more,- icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedMoreVertical,+ color: foregroundColor,+ ),optionsBuilder: () => items,onSelected: (ClusterPopupAction value) async {if (value == ClusterPopupAction.breakupCluster) {diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dartindex 3a8bc73e7b..319f90c14b 100644--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart@@ -32,12 +32,12 @@ import "package:photos/ui/viewer/people/memory_lane_page_v2.dart";import "package:photos/ui/viewer/people/people_page.dart";import "package:photos/ui/viewer/people/person_face_widget.dart";import "package:photos/ui/viewer/people/save_person_banner.dart";-import "package:photos/ui/viewer/search/result/search_result_page.dart";class ClusterPage extends StatefulWidget {final List<EnteFile> searchResult;final bool enableGrouping;final String tagPrefix;+ final String? coverHeroTag;final String clusterID;final PersonEntity? personID;final String appendTitle;@@ -50,6 +50,7 @@ class ClusterPage extends StatefulWidget {this.searchResult, {this.enableGrouping = true,this.tagPrefix = "",+ this.coverHeroTag,required this.clusterID,this.personID,this.appendTitle = "",@@ -65,6 +66,7 @@ enum ClusterPageResult { ignoredPerson }class _ClusterPageState extends State<ClusterPage> {final _selectedFiles = SelectedFiles();+ final _coverAppBarKey = GlobalKey();late final List<EnteFile> files;late final StreamSubscription<LocalPhotosUpdatedEvent> _filesUpdatedEvent;late final StreamSubscription<PeopleChangedEvent> _peopleChangedEvent;@@ -192,10 +194,13 @@ class _ClusterPageState extends State<ClusterPage> {@overrideWidget build(BuildContext context) {final appBar = ClusterAppBar.sliverConfig(- SearchResultPage.appBarType,+ ClusterPage.appBarType,"${files.length} memories${widget.appendTitle}",_selectedFiles,widget.clusterID,+ coverAppBarKey: _coverAppBarKey,+ coverHeroTag: widget.coverHeroTag,+ files: files,memoryLaneReady: widget.personID == null? MemoryLaneService.instance.hasReadyTimelineSync(widget.clusterID,diff --git a/mobile/apps/photos/lib/ui/viewer/people/face_thumbnail_squircle.dart b/mobile/apps/photos/lib/ui/viewer/people/face_thumbnail_squircle.dartindex 5457b65217..412a52ee69 100644--- a/mobile/apps/photos/lib/ui/viewer/people/face_thumbnail_squircle.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/face_thumbnail_squircle.dart@@ -1,6 +1,7 @@import "dart:math" as math;import "package:flutter/widgets.dart";+import "package:photos/ui/viewer/file/hero_image.dart";// RSuperellipse radii above half the side collapse into a circle. This factor// preserves the previous iOS-style squircle shape.@@ -35,25 +36,57 @@ Path faceThumbnailSquircleOuterPath(Size size) {return Path()..addRSuperellipse(radius.toRSuperellipse(rect));}-class FaceThumbnailSquircleClip extends StatelessWidget {+class FaceThumbnailSquircleClip extends StatefulWidget {final Widget child;final BorderRadiusGeometry? borderRadius;+ final String? heroTag;const FaceThumbnailSquircleClip({required this.child,this.borderRadius,+ this.heroTag,super.key,});+ @override+ State<FaceThumbnailSquircleClip> createState() =>+ _FaceThumbnailSquircleClipState();+}++class _FaceThumbnailSquircleClipState extends State<FaceThumbnailSquircleClip> {+ late final _heroChildKey = GlobalKey();+@overrideWidget build(BuildContext context) {- if (borderRadius != null) {- return ClipRSuperellipse(borderRadius: borderRadius!, child: child);+ if (widget.heroTag != null) {+ return LayoutBuilder(+ builder: (context, constraints) => Hero(+ tag: widget.heroTag!,+ createRectTween: imageHeroRectTween,+ placeholderBuilder: imageHeroPlaceholderBuilder,+ transitionOnUserGestures: true,+ child: ClipRSuperellipse(+ key: _heroChildKey,+ borderRadius:+ widget.borderRadius ??+ faceThumbnailSquircleBorderRadius(+ constraints.biggest.shortestSide,+ ),+ child: widget.child,+ ),+ ),+ );+ }+ if (widget.borderRadius != null) {+ return ClipRSuperellipse(+ borderRadius: widget.borderRadius!,+ child: widget.child,+ );}return ClipRSuperellipse(clipper: const _FaceThumbnailSquircleClipper(),- child: child,+ child: widget.child,);}}diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dartindex c33d613112..84cbf2b1f9 100644--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart@@ -10,23 +10,23 @@ import 'package:photos/core/configuration.dart';import 'package:photos/core/event_bus.dart';import "package:photos/events/people_changed_event.dart";import 'package:photos/events/subscription_purchased_event.dart';+import 'package:photos/models/file/file.dart';import 'package:photos/models/gallery_type.dart';import "package:photos/models/ml/face/person.dart";import 'package:photos/models/selected_files.dart';import 'package:photos/services/collections_service.dart';import "package:photos/services/machine_learning/face_ml/person/person_service.dart";-import "package:photos/theme/ente_theme.dart";import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';import "package:photos/ui/components/buttons/button_widget.dart";import "package:photos/ui/notification/toast.dart";import 'package:photos/ui/sharing/share_person_sheet.dart';import "package:photos/ui/viewer/gallery/gallery_app_bar_actions.dart";import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";+import "package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart";import "package:photos/ui/viewer/gallery/hooks/pick_person_avatar.dart";import 'package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart';-import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";-import "package:photos/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart";import "package:photos/ui/viewer/people/person_cluster_suggestion.dart";+import "package:photos/ui/viewer/people/person_face_widget.dart";import "package:photos/ui/viewer/people/reassign_me_selection_page.dart";import "package:photos/ui/viewer/people/save_or_edit_person.dart";import "package:photos/utils/dialog_util.dart";@@ -36,46 +36,45 @@ const kShowUnnamedIgnoredPersonEventSource ="_AppBarWidgetState._showPersonUnnamedDelete";class PeopleAppBar extends StatefulWidget {- static const double _sliverExpandedHeight = 92.0;-static GalleryAppBarConfig sliverConfig(GalleryType type,String? title,SelectedFiles selectedFiles,PersonEntity person, {+ required List<EnteFile> files,+ Key? coverAppBarKey,+ String? coverHeroTag,bool memoryLaneReady = false,Future<void> Function()? onMemoryLaneTap,}) {+ final config = GalleryAppBarWidget.sliverConfig(+ type,+ title,+ selectedFiles,+ coverWidget: files.isEmpty+ ? null+ : PersonFaceWidget(personId: person.remoteID),+ );return GalleryAppBarConfig(+ extendBodyForCollapse: config.extendBodyForCollapse,sliverBuilder: (_) => PeopleAppBar._(type,title,selectedFiles,person,+ files: files,+ coverAppBarKey: coverAppBarKey,+ coverHeroTag: coverHeroTag,memoryLaneReady: memoryLaneReady,onMemoryLaneTap: onMemoryLaneTap,),- geometryBuilder: _resolveSliverGeometry,- );- }-- static HeaderAppBarGeometry _resolveSliverGeometry(BuildContext context) {- final inheritedSearchFilterData = InheritedSearchFilterData.maybeOf(- context,- );- final isHierarchicalSearchable =- inheritedSearchFilterData?.isHierarchicalSearchable ?? false;- final bottomHeight = isHierarchicalSearchable- ? AppBarFilterChips.preferredHeight(context)- : 0.0;- return SliverAppBarComponent.resolveGeometry(- context,- expandedHeight: _sliverExpandedHeight,- collapsedHeight: kToolbarHeight,- bottomHeight: bottomHeight,+ geometryBuilder: config.geometryBuilder,);}+ final List<EnteFile> files;+ final Key? coverAppBarKey;+ final String? coverHeroTag;final GalleryType type;final String? title;final SelectedFiles selectedFiles;@@ -92,6 +91,9 @@ class PeopleAppBar extends StatefulWidget {this.person, {this.memoryLaneReady = false,this.onMemoryLaneTap,+ required this.files,+ this.coverAppBarKey,+ this.coverHeroTag,});@override@@ -156,31 +158,31 @@ class _AppBarWidgetState extends State<PeopleAppBar> {setState(() {});});- WidgetsBinding.instance.addPostFrameCallback((_) {- setState(() {- _appBarTitle = _resolveAppBarTitle(- sourcePerson: person,- title: widget.title,- );-- _peopleChangedEventSubscription = Bus.instance- .on<PeopleChangedEvent>()- .listen((event) {- if (event.person != null &&- event.type == PeopleEventType.saveOrEditPerson &&- widget.person.remoteID == event.person!.remoteID &&- event.source == "reassignMe") {- person = event.person!;-- _appBarTitle = _resolveAppBarTitle(- sourcePerson: person,- title: person.data.name,- );- setState(() {});- }+ _peopleChangedEventSubscription = Bus.instance+ .on<PeopleChangedEvent>()+ .listen((event) {+ if (event.person != null &&+ event.type == PeopleEventType.saveOrEditPerson &&+ widget.person.remoteID == event.person!.remoteID &&+ event.source == "reassignMe") {+ person = event.person!;+ setState(() {+ _appBarTitle = _resolveAppBarTitle(+ sourcePerson: person,+ title: person.data.name,+ );});- });- });+ }+ });+ }++ @override+ void didChangeDependencies() {+ super.didChangeDependencies();+ _appBarTitle = _resolveAppBarTitle(+ sourcePerson: person,+ title: widget.title,+ );}@override@@ -209,49 +211,44 @@ class _AppBarWidgetState extends State<PeopleAppBar> {@overrideWidget build(BuildContext context) {- final inheritedSearchFilterData = InheritedSearchFilterData.maybeOf(- context,- );- final isHierarchicalSearchable =- inheritedSearchFilterData?.isHierarchicalSearchable ?? false;-- if (!isHierarchicalSearchable) {- return _buildSliverAppBar(context, actions: _getDefaultActions(context));- }-- return ValueListenableBuilder(- valueListenable: inheritedSearchFilterData!- .searchFilterDataProvider!- .isSearchingNotifier,- child: PreferredSize(- preferredSize: Size.fromHeight(- AppBarFilterChips.preferredHeight(context),- ),- child: const AppBarFilterChips(),- ),- builder: (context, isSearching, child) {- return _buildSliverAppBar(- context,- actions: isSearching ? const [] : _getDefaultActions(context),- bottom: child as PreferredSizeWidget,- );- },- );- }-- Widget _buildSliverAppBar(- BuildContext context, {- required List<Widget> actions,- PreferredSizeWidget? bottom,- }) {- return SliverAppBarComponent(- title: _appBarTitle ?? "",- actions: actions,- bottom: bottom,- expandedHeight: PeopleAppBar._sliverExpandedHeight,- collapsedHeight: kToolbarHeight,- backgroundColor: getEnteColorScheme(context).backgroundColour,- );+ final currentUserID = Configuration.instance.getUserID();+ final shareableFiles =+ widget.selectedFiles.files.isEmpty &&+ Configuration.instance.hasConfiguredAccount() &&+ !person.data.isIgnored &&+ person.data.name.trim().isNotEmpty+ ? GalleryFilesState.maybeOf(context)?.galleryFilesOrNull+ ?.where(+ (file) =>+ file.uploadedFileID != null &&+ file.ownerID == currentUserID,+ )+ .toList()+ : null;+ return GalleryAppBarWidget.sliverConfig(+ widget.type,+ _appBarTitle,+ widget.selectedFiles,+ files: widget.files,+ coverAppBarKey: widget.coverAppBarKey,+ coverWidget: widget.files.isEmpty+ ? null+ : PersonFaceWidget(+ personId: person.remoteID,+ cachedPixelWidth:+ (MediaQuery.sizeOf(context).width *+ MediaQuery.devicePixelRatioOf(context))+ .ceil(),+ ),+ coverHeroTag: widget.coverHeroTag,+ actionsBuilder: ({required onCover, foregroundColor}) =>+ _getDefaultActions(+ context,+ onCover: onCover,+ foregroundColor: foregroundColor,+ shareableFiles: shareableFiles,+ ),+ ).buildSliver(context);}Future<dynamic> _editPerson(BuildContext context) async {@@ -270,7 +267,12 @@ class _AppBarWidgetState extends State<PeopleAppBar> {}}- List<Widget> _getDefaultActions(BuildContext context) {+ List<Widget> _getDefaultActions(+ BuildContext context, {+ required bool onCover,+ Color? foregroundColor,+ required List<EnteFile>? shareableFiles,+ }) {final bool isIgnored = person.data.isIgnored;final bool isPinned = person.data.isPinned;final bool hideFromMemories = person.data.hideFromMemories;@@ -281,28 +283,28 @@ class _AppBarWidgetState extends State<PeopleAppBar> {return actions;}- final currentUserID = Configuration.instance.getUserID();- final files = GalleryFilesState.maybeOf(context)?.galleryFilesOrNull- ?.where(- (file) =>- file.uploadedFileID != null && file.ownerID == currentUserID,- )- .toList();if (!isIgnored &&person.data.name.trim().isNotEmpty &&- files != null &&- files.isNotEmpty) {+ shareableFiles != null &&+ shareableFiles.isNotEmpty) {actions.add(IconButtonComponent(key: shareButtonKey,- icon: const HugeIcon(icon: HugeIcons.strokeRoundedShare08),- variant: IconButtonComponentVariant.primary,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedShare08,+ color: foregroundColor,+ ),+ variant: onCover+ ? IconButtonComponentVariant.unfilled+ : IconButtonComponentVariant.primary,+ size: onCover ? kMinInteractiveDimension : 36,+ iconSize: onCover ? IconSizes.medium : IconSizes.small,tooltip: context.strings.share,shouldSurfaceExecutionStates: false,onTap: () => showSharePersonSheet(context,person: person,- files: files,+ files: shareableFiles,shareButtonKey: shareButtonKey,),),@@ -436,10 +438,16 @@ class _AppBarWidgetState extends State<PeopleAppBar> {]);}+ final overflowMenuAction = onCover+ ? galleryAppBarActionsSheetAction+ : galleryAppBarPopupMenuAction;actions.add(- galleryAppBarPopupMenuAction<PeoplePopupAction>(+ overflowMenuAction<PeoplePopupAction>(tooltip: context.strings.more,- icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedMoreVertical,+ color: foregroundColor,+ ),optionsBuilder: () => items,onSelected: (PeoplePopupAction value) async {if (value == PeoplePopupAction.reviewSuggestions) {diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart b/mobile/apps/photos/lib/ui/viewer/people/people_page.dartindex 4887ef2cbb..53a37f248e 100644--- a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart@@ -36,6 +36,7 @@ import "package:photos/ui/viewer/people/person_gallery_suggestion.dart";class PeoplePage extends StatefulWidget {final String tagPrefix;+ final String? coverHeroTag;final PersonEntity person;final SearchResult? searchResult;@@ -44,6 +45,7 @@ class PeoplePage extends StatefulWidget {const PeoplePage({this.tagPrefix = "",+ this.coverHeroTag,required this.person,required this.searchResult,super.key,@@ -57,6 +59,7 @@ class _PeoplePageState extends State<PeoplePage> {final Logger _logger = Logger("_PeoplePageState");final Logger _timelineLogger = Logger("MemoryLaneInteractions");final _selectedFiles = SelectedFiles();+ final _coverAppBarKey = GlobalKey();List<EnteFile>? files;late PersonEntity _person;@@ -76,6 +79,9 @@ class _PeoplePageState extends State<PeoplePage> {void initState() {super.initState();_person = widget.person;+ files = widget.searchResult == null+ ? null+ : List.of(widget.searchResult!.resultFiles());ClusterFeedbackService.resetLastViewedClusterID();_peopleChangedEvent = Bus.instance.on<PeopleChangedEvent>().listen((event) {if (event.source == kShowUnnamedIgnoredPersonEventSource &&@@ -136,9 +142,8 @@ class _PeoplePageState extends State<PeoplePage> {includeManualAssigned: true,sortOnTime: true,);- final previousCount = files?.length;files = sortedFiles;- if (mounted && previousCount != sortedFiles.length) {+ if (mounted) {setState(() {});}return sortedFiles;@@ -245,6 +250,9 @@ class _PeoplePageState extends State<PeoplePage> {_getPeoplePageTitle(context),_selectedFiles,_person,+ coverAppBarKey: _coverAppBarKey,+ coverHeroTag: widget.coverHeroTag,+ files: files ?? const [],memoryLaneReady: memoryLaneReady,onMemoryLaneTap: _openMemoryLanePage,);diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart b/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dartindex 82bb2849cd..cdb016da3b 100644--- a/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart@@ -1,3 +1,4 @@+import "package:ente_pure_utils/ente_pure_utils.dart";import "package:ente_strings/ente_strings.dart";import "package:ente_ui/components/loading_widget.dart";import "package:flutter/cupertino.dart";@@ -49,15 +50,19 @@ class _PersonClustersPageState extends State<PersonClustersPage> {final List<EnteFile> files = clusters[clusterID]!;return InkWell(onTap: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (context) => ClusterPage(- files,- personID: widget.person,+ routeToPage(+ context,+ ClusterPage(+ files,+ personID: widget.person,+ clusterID: clusterID,+ coverHeroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: "person_clusters",clusterID: clusterID,- showNamingBanner: false,),+ showNamingBanner: false,),+ useFadeTransition: true,);},child: Container(@@ -68,6 +73,10 @@ class _PersonClustersPageState extends State<PersonClustersPage> {width: 100,height: 100,child: FaceThumbnailSquircleClip(+ heroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: "person_clusters",+ clusterID: clusterID,+ ),child: files.isNotEmpty? PersonFaceWidget(clusterID: clusterID): const NoThumbnailWidget(addBorder: false),@@ -281,15 +290,19 @@ class __ClusterWrapperForGirdState extends State<_ClusterWrapperForGird> {},child: GestureDetector(onTap: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (context) => ClusterPage(- widget.files,- personID: widget.person,+ routeToPage(+ context,+ ClusterPage(+ widget.files,+ personID: widget.person,+ clusterID: widget.clusterID,+ coverHeroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: "person_clusters",clusterID: widget.clusterID,- showNamingBanner: false,),+ showNamingBanner: false,),+ useFadeTransition: true,);},child: _isVisible@@ -304,6 +317,10 @@ class __ClusterWrapperForGirdState extends State<_ClusterWrapperForGird> {fit: StackFit.expand,children: [FaceThumbnailSquircleClip(+ heroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: "person_clusters",+ clusterID: widget.clusterID,+ ),child: widget.files.isNotEmpty? PersonFaceWidget(clusterID: widget.clusterID): const NoThumbnailWidget(addBorder: false),diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dart b/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dartindex 5c5dfae243..02338ec28d 100644--- a/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/person_face_widget.dart@@ -28,6 +28,14 @@ import "package:photos/utils/face/face_thumbnail_cache.dart";final _logger = Logger("PersonFaceWidget");class PersonFaceWidget extends StatefulWidget {+ static String coverHeroTag({+ required String tagPrefix,+ String? personId,+ String? clusterID,+ }) => personId != null+ ? "$tagPrefix:person_cover:$personId"+ : "$tagPrefix:cluster_cover:$clusterID";+final String? personId;final String? clusterID;final bool useFullFile;diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dartindex 5545749a23..ae5db9d1a9 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart@@ -263,6 +263,11 @@ class SelectablePersonSearchExample extends StatelessWidget {width: size - 2,height: size - 2,child: FaceThumbnailSquircleClip(+ heroTag: PersonFaceWidget.coverHeroTag(+ tagPrefix: "all_people",+ personId: searchResult.params[kPersonParamID],+ clusterID: searchResult.params[kClusterParamId],+ ),child: Stack(fit: StackFit.expand,children: [@@ -532,6 +537,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {minClusterSize: kMinimumClusterSizeAllFaces,showIgnoredOnly: _showingIgnoredPeople,includeEmptyPersons: widget.includeEmptyPersons,+ coverHeroTagPrefix: "all_people",);normalFaces.clear();extraFaces.clear();diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dartindex 9c9f012266..f57be01784 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dart@@ -4,12 +4,13 @@ import "package:photos/models/search/generic_search_result.dart";import "package:photos/models/search/search_constants.dart";import "package:photos/models/search/search_result.dart";import "package:photos/models/search/search_types.dart";+import "package:photos/ui/viewer/file/hero_image.dart";import 'package:photos/ui/viewer/file/no_thumbnail_widget.dart';import 'package:photos/ui/viewer/file/thumbnail_widget.dart';import 'package:photos/ui/viewer/people/person_face_widget.dart';import "package:photos/ui/viewer/search/contact_avatar_widget.dart";-class SearchThumbnailWidget extends StatelessWidget {+class SearchThumbnailWidget extends StatefulWidget {final EnteFile? file;final SearchResult? searchResult;final String tagPrefix;@@ -25,32 +26,52 @@ class SearchThumbnailWidget extends StatelessWidget {super.key,});+ @override+ State<SearchThumbnailWidget> createState() => _SearchThumbnailWidgetState();+}++class _SearchThumbnailWidgetState extends State<SearchThumbnailWidget> {+ late final _heroChildKey = GlobalKey();+@overrideWidget build(BuildContext context) {final isLocation =- searchResult?.type() == ResultType.location ||- searchResult?.type() == ResultType.locationSuggestion;+ widget.searchResult?.type() == ResultType.location ||+ widget.searchResult?.type() == ResultType.locationSuggestion;+ final result = widget.searchResult;+ final isPerson =+ result is GenericSearchResult && result.type() == ResultType.faces;return Hero(- tag: isLocation ? tagPrefix : tagPrefix + (file?.tag ?? ""),- createRectTween: isLocation+ tag: isPerson+ ? PersonFaceWidget.coverHeroTag(+ tagPrefix: "people_search",+ personId: result.params[kPersonParamID],+ clusterID: result.params[kClusterParamId],+ )+ : isLocation+ ? widget.tagPrefix+ : widget.tagPrefix + (widget.file?.tag ?? ""),+ createRectTween: isLocation || isPerson? (begin, end) => RectTween(begin: begin, end: end): null,- transitionOnUserGestures: isLocation,+ transitionOnUserGestures: isLocation || isPerson,+ placeholderBuilder: isPerson ? imageHeroPlaceholderBuilder : null,child: SizedBox(- height: size,- width: size,+ key: isPerson ? _heroChildKey : null,+ height: widget.size,+ width: widget.size,child: ClipRRect(- borderRadius: BorderRadius.circular(borderRadius),- child: file != null- ? (searchResult != null &&- searchResult!.type() == ResultType.faces)+ borderRadius: BorderRadius.circular(widget.borderRadius),+ child: widget.file != null+ ? (widget.searchResult != null &&+ widget.searchResult!.type() == ResultType.faces)? PersonFaceWidget(- personId: (searchResult as GenericSearchResult)+ personId: (widget.searchResult as GenericSearchResult).params[kPersonParamID],- clusterID: (searchResult as GenericSearchResult)+ clusterID: (widget.searchResult as GenericSearchResult).params[kClusterParamId],)- : ThumbnailWidget(file!)+ : ThumbnailWidget(widget.file!): const NoThumbnailWidget(addBorder: false),),),diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dartindex 3d18fa3b83..6fe7898486 100644--- a/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart@@ -246,6 +246,14 @@ class PersonSearchExample extends StatelessWidget {width: size - 2,height: size - 2,child: FaceThumbnailSquircleClip(+ heroTag: selectedPeople == null+ ? PersonFaceWidget.coverHeroTag(+ tagPrefix: "people_discover",+ personId: searchResult.params[kPersonParamID],+ clusterID:+ searchResult.params[kClusterParamId],+ )+ : null,child: Stack(fit: StackFit.expand,children: [diff --git a/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dartindex f02c739355..4830b37a56 100644--- a/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart+++ b/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart@@ -16,8 +16,76 @@ import "package:photos/models/metadata/collection_magic.dart";import "package:photos/services/app_navigation_service.dart";import "package:photos/ui/viewer/gallery/component/album_cover_app_bar.dart";import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";+import "package:photos/ui/viewer/people/face_thumbnail_squircle.dart";void main() {+ testWidgets("preserves the face through rounded cover transitions", (+ tester,+ ) async {+ final bytes = base64Decode(_onePixelPng);+ final face = find.byKey(const ValueKey("face-image"));+ await tester.pumpWidget(+ MaterialApp(+ theme: lightThemeData,+ home: Scaffold(+ body: Center(+ child: SizedBox.square(+ dimension: 80,+ child: FaceThumbnailSquircleClip(+ heroTag: "person-cover",+ child: Image.memory(bytes, key: const ValueKey("face-image")),+ ),+ ),+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ final sourceState = tester.state(face);+ final context = tester.element(face);+ for (final reverseEarly in [false, true]) {+ unawaited(+ routeToPage(+ context,+ Scaffold(+ body: CustomScrollView(+ slivers: [+ AlbumCoverAppBar(+ coverWidget: Image.memory(bytes, fit: BoxFit.cover),+ heroTag: "person-cover",+ title: "Person",+ actionsBuilder: (_) => const [],+ coverActions: const [],+ backgroundColor: lightThemeData.scaffoldBackgroundColor,+ collapsedHeight: kToolbarHeight,+ ),+ ],+ ),+ ),+ useFadeTransition: true,+ ),+ );+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 80));+ expect(+ tester+ .widget<ClipRSuperellipse>(find.byType(ClipRSuperellipse))+ .borderRadius+ .resolve(TextDirection.ltr)+ .topLeft+ .x,+ inExclusiveRange(0, 24),+ );+ if (!reverseEarly) await tester.pumpAndSettle();+ Navigator.of(context).pop();+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 40));+ expect(find.byType(ClipRSuperellipse), findsOneWidget);+ await tester.pumpAndSettle();+ expect(tester.state(face), same(sourceState));+ expect(tester.takeException(), isNull);+ }+ });testWidgets("supports a device folder cover with its backup status", (tester,) async {