From f8fe2bd7f28e3f206ed08bb028b114c9d2caca71 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Thu, 24 Jul 2025 11:29:43 +0530 Subject: [PATCH] Stop usage of continously animating widget which is offscreen and taken up compute --- .../lib/ui/tabs/shared_collections_tab.dart | 136 +++++++++--------- 1 file changed, 67 insertions(+), 69 deletions(-) diff --git a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart b/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart index 9f81a2428c..8799c1045c 100644 --- a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart +++ b/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart @@ -170,8 +170,7 @@ class _SharedCollectionsTabState extends State context, CollectionListPage( collections.incoming, - sectionType: - UISectionType.incomingCollections, + sectionType: UISectionType.incomingCollections, tag: "incoming", appTitle: sharedWithYou, ), @@ -227,8 +226,7 @@ class _SharedCollectionsTabState extends State context, CollectionListPage( collections.outgoing, - sectionType: - UISectionType.outgoingCollections, + sectionType: UISectionType.outgoingCollections, tag: "outgoing", appTitle: sharedByYou, ), @@ -275,72 +273,72 @@ class _SharedCollectionsTabState extends State ), numberOfQuickLinks > 0 ? Column( - children: [ - SectionOptions( - onTap: numberOfQuickLinks > maxQuickLinks - ? () { - unawaited( - routeToPage( - context, - AllQuickLinksPage( - titleHeroTag: quickLinkTitleHeroTag, - quickLinks: collections.quickLinks, + children: [ + SectionOptions( + onTap: numberOfQuickLinks > maxQuickLinks + ? () { + unawaited( + routeToPage( + context, + AllQuickLinksPage( + titleHeroTag: quickLinkTitleHeroTag, + quickLinks: collections.quickLinks, + ), ), - ), - ); - } - : null, - Hero( - tag: quickLinkTitleHeroTag, - child: SectionTitle( - title: S.of(context).quickLinks, - ), - ), - trailingWidget: numberOfQuickLinks > maxQuickLinks - ? IconButtonWidget( - icon: Icons.chevron_right, - iconButtonType: IconButtonType.secondary, - iconColor: colorTheme.blurStrokePressed, - ) - : null, - ), - const SizedBox(height: 2), - ListView.separated( - shrinkWrap: true, - padding: const EdgeInsets.only( - bottom: 12, - left: 12, - right: 12, - ), - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () async { - final thumbnail = await CollectionsService - .instance - .getCover(collections.quickLinks[index]); - final page = CollectionPage( - CollectionWithThumbnail( - collections.quickLinks[index], - thumbnail, - ), - tagPrefix: heroTagPrefix, - ); - // ignore: unawaited_futures - routeToPage(context, page); - }, - child: QuickLinkAlbumItem( - c: collections.quickLinks[index], + ); + } + : null, + Hero( + tag: quickLinkTitleHeroTag, + child: SectionTitle( + title: S.of(context).quickLinks, ), - ); - }, - separatorBuilder: (context, index) { - return const SizedBox(height: 4); - }, - itemCount: min(numberOfQuickLinks, maxQuickLinks), - ), - ], - ) + ), + trailingWidget: numberOfQuickLinks > maxQuickLinks + ? IconButtonWidget( + icon: Icons.chevron_right, + iconButtonType: IconButtonType.secondary, + iconColor: colorTheme.blurStrokePressed, + ) + : null, + ), + const SizedBox(height: 2), + ListView.separated( + shrinkWrap: true, + padding: const EdgeInsets.only( + bottom: 12, + left: 12, + right: 12, + ), + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () async { + final thumbnail = await CollectionsService + .instance + .getCover(collections.quickLinks[index]); + final page = CollectionPage( + CollectionWithThumbnail( + collections.quickLinks[index], + thumbnail, + ), + tagPrefix: heroTagPrefix, + ); + // ignore: unawaited_futures + routeToPage(context, page); + }, + child: QuickLinkAlbumItem( + c: collections.quickLinks[index], + ), + ); + }, + separatorBuilder: (context, index) { + return const SizedBox(height: 4); + }, + itemCount: min(numberOfQuickLinks, maxQuickLinks), + ), + ], + ) : const SizedBox.shrink(), const SizedBox(height: 2), ValueListenableBuilder( @@ -367,7 +365,7 @@ class _SharedCollectionsTabState extends State } }, ) - : const EnteLoadingWidget(); + : const SizedBox.shrink(); }, ), const CollectPhotosCardWidget(),