From e4b777ecef6d36ea48d1f6bc40d332d989538a21 Mon Sep 17 00:00:00 2001 From: Dhrumil Shah Date: Tue, 7 May 2024 23:52:56 -0400 Subject: [PATCH] feat(mobile): Add pull to refresh to sharing page (#9274) * Add pull to refresh to sharing page * Fix format --- mobile/lib/pages/sharing/sharing.page.dart | 73 ++++++++++++---------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/mobile/lib/pages/sharing/sharing.page.dart b/mobile/lib/pages/sharing/sharing.page.dart index 23ffbcfbfa..45148945ed 100644 --- a/mobile/lib/pages/sharing/sharing.page.dart +++ b/mobile/lib/pages/sharing/sharing.page.dart @@ -220,51 +220,56 @@ class SharingPage extends HookConsumerWidget { ); } - return Scaffold( - appBar: ImmichAppBar( - action: sharePartnerButton(), - ), - body: CustomScrollView( - slivers: [ - SliverToBoxAdapter(child: buildTopBottons()), - if (partner.isNotEmpty) + return RefreshIndicator( + onRefresh: () async { + ref.read(sharedAlbumProvider.notifier).getAllSharedAlbums(); + }, + child: Scaffold( + appBar: ImmichAppBar( + action: sharePartnerButton(), + ), + body: CustomScrollView( + slivers: [ + SliverToBoxAdapter(child: buildTopBottons()), + if (partner.isNotEmpty) + SliverPadding( + padding: const EdgeInsets.all(12), + sliver: SliverToBoxAdapter( + child: Text( + "partner_page_title", + style: context.textTheme.bodyLarge?.copyWith( + fontWeight: FontWeight.w500, + ), + ).tr(), + ), + ), + if (partner.isNotEmpty) PartnerList(partner: partner), SliverPadding( padding: const EdgeInsets.all(12), sliver: SliverToBoxAdapter( child: Text( - "partner_page_title", + "sharing_page_album", style: context.textTheme.bodyLarge?.copyWith( fontWeight: FontWeight.w500, ), ).tr(), ), ), - if (partner.isNotEmpty) PartnerList(partner: partner), - SliverPadding( - padding: const EdgeInsets.all(12), - sliver: SliverToBoxAdapter( - child: Text( - "sharing_page_album", - style: context.textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w500, - ), - ).tr(), - ), - ), - SliverLayoutBuilder( - builder: (context, constraints) { - if (sharedAlbums.isEmpty) { - return buildEmptyListIndication(); - } + SliverLayoutBuilder( + builder: (context, constraints) { + if (sharedAlbums.isEmpty) { + return buildEmptyListIndication(); + } - if (constraints.crossAxisExtent < 600) { - return buildAlbumList(); - } else { - return buildAlbumGrid(); - } - }, - ), - ], + if (constraints.crossAxisExtent < 600) { + return buildAlbumList(); + } else { + return buildAlbumGrid(); + } + }, + ), + ], + ), ), ); }