diff --git a/app/lib/ui/flow/home/components/app_media_item.dart b/app/lib/ui/flow/home/components/app_media_item.dart index 15f9a2f..7825a95 100644 --- a/app/lib/ui/flow/home/components/app_media_item.dart +++ b/app/lib/ui/flow/home/components/app_media_item.dart @@ -90,11 +90,11 @@ class _AppMediaItemState extends State mainAxisSize: MainAxisSize.min, children: [ if (widget.media.sources.contains(AppMediaSource.googleDrive)) - SvgPicture.asset( - Assets.images.icons.googlePhotos, - height: 12, - width: 12, - ), + SvgPicture.asset( + Assets.images.icons.googlePhotos, + height: 12, + width: 12, + ), if (widget.isUploading) const AppCircularProgressIndicator(size: 12), ], ), @@ -104,15 +104,15 @@ class _AppMediaItemState extends State Widget _buildImageView({required BuildContext context}) { return LayoutBuilder(builder: (context, constraints) { return Image( - image: ResizeImage( - widget.media.sources.contains(AppMediaSource.local) - ? FileImage(File(widget.media.path)) - : CachedNetworkImageProvider(widget.media.thumbnailPath!) - as ImageProvider, - height: constraints.maxHeight.toInt(), - width: constraints.maxWidth.toInt(), - policy: ResizeImagePolicy.fit, - ), + image: widget.media.sources.contains(AppMediaSource.local) + ? ResizeImage( + FileImage(File(widget.media.path)), + height: constraints.maxHeight.toInt(), + width: constraints.maxWidth.toInt(), + policy: ResizeImagePolicy.fit, + ) + : CachedNetworkImageProvider(widget.media.thumbnailPath!) + as ImageProvider, fit: BoxFit.cover, loadingBuilder: (context, child, loadingProgress) { if (loadingProgress == null) { diff --git a/app/lib/ui/flow/home/home_screen.dart b/app/lib/ui/flow/home/home_screen.dart index 72e8ec0..fe7e25b 100644 --- a/app/lib/ui/flow/home/home_screen.dart +++ b/app/lib/ui/flow/home/home_screen.dart @@ -1,4 +1,5 @@ import 'package:cloud_gallery/components/app_page.dart'; +import 'package:cloud_gallery/components/resume_detector.dart'; import 'package:cloud_gallery/domain/extensions/context_extensions.dart'; import 'package:cloud_gallery/ui/flow/home/components/no_local_medias_access_screen.dart'; import 'package:cloud_gallery/ui/flow/home/home_screen_view_model.dart'; @@ -97,21 +98,24 @@ class _HomeScreenState extends ConsumerState { } else if (medias.isEmpty && !hasLocalMediaAccess) { return const NoLocalMediasAccessScreen(); } - return Stack( - alignment: Alignment.bottomRight, - children: [ - _buildMediaList( - context: context, - medias: medias, - uploadingMedias: uploadingMedias, - selectedMedias: selectedMedias, - ), - if (selectedMedias.isNotEmpty) - Padding( - padding: context.systemPadding + const EdgeInsets.all(16), - child: const MultiSelectionDoneButton(), + return ResumeDetector( + onResume: notifier.loadMedias, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + _buildMediaList( + context: context, + medias: medias, + uploadingMedias: uploadingMedias, + selectedMedias: selectedMedias, ), - ], + if (selectedMedias.isNotEmpty) + Padding( + padding: context.systemPadding + const EdgeInsets.all(16), + child: const MultiSelectionDoneButton(), + ), + ], + ), ); } @@ -134,7 +138,6 @@ class _HomeScreenState extends ConsumerState { header: Container( padding: const EdgeInsets.only(left: 16), alignment: Alignment.centerLeft, - decoration: BoxDecoration( color: context.colorScheme.surface, ), @@ -147,8 +150,6 @@ class _HomeScreenState extends ConsumerState { ), ), pinned: true, - floating: true, - // floating: true, ), SliverPadding( padding: diff --git a/app/lib/ui/flow/home/home_screen_view_model.dart b/app/lib/ui/flow/home/home_screen_view_model.dart index f4571d0..b1cfc88 100644 --- a/app/lib/ui/flow/home/home_screen_view_model.dart +++ b/app/lib/ui/flow/home/home_screen_view_model.dart @@ -123,6 +123,7 @@ class HomeViewStateNotifier extends StateNotifier { try { if (!_authService.hasUserSigned) { await _authService.signInWithGoogle(); + loadMedias(); } List uploadingMedias = state.selectedMedias .where((element) =>