Skip to content

Commit

Permalink
Home improvement (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k authored Mar 7, 2024
1 parent dfc751b commit f6efd79
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
28 changes: 14 additions & 14 deletions app/lib/ui/flow/home/components/app_media_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ class _AppMediaItemState extends State<AppMediaItem>
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),
],
),
Expand All @@ -104,15 +104,15 @@ class _AppMediaItemState extends State<AppMediaItem>
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) {
Expand Down
35 changes: 18 additions & 17 deletions app/lib/ui/flow/home/home_screen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -97,21 +98,24 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
} 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(),
),
],
),
);
}

Expand All @@ -134,7 +138,6 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
header: Container(
padding: const EdgeInsets.only(left: 16),
alignment: Alignment.centerLeft,

decoration: BoxDecoration(
color: context.colorScheme.surface,
),
Expand All @@ -147,8 +150,6 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
),
),
pinned: true,
floating: true,
// floating: true,
),
SliverPadding(
padding:
Expand Down
1 change: 1 addition & 0 deletions app/lib/ui/flow/home/home_screen_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class HomeViewStateNotifier extends StateNotifier<HomeViewState> {
try {
if (!_authService.hasUserSigned) {
await _authService.signInWithGoogle();
loadMedias();
}
List<AppMedia> uploadingMedias = state.selectedMedias
.where((element) =>
Expand Down

0 comments on commit f6efd79

Please sign in to comment.