-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f01e029
commit c8017c2
Showing
15 changed files
with
434 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: ice License 1.0 | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'album_data.c.freezed.dart'; | ||
|
||
@freezed | ||
class AlbumData with _$AlbumData { | ||
const factory AlbumData({ | ||
required String id, | ||
required String name, | ||
required int assetCount, | ||
@Default(false) bool isAll, | ||
}) = _AlbumData; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// SPDX-License-Identifier: ice License 1.0 | ||
|
||
export 'album_data.c.dart'; | ||
export 'gallery_state.c.dart'; | ||
export 'media_selection_state.c.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
lib/app/features/gallery/views/components/albums/album_item.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// SPDX-License-Identifier: ice License 1.0 | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:ion/app/components/screen_offset/screen_side_offset.dart'; | ||
import 'package:ion/app/extensions/extensions.dart'; | ||
import 'package:ion/app/features/gallery/views/components/albums/album_thumbnail.dart'; | ||
import 'package:ion/generated/assets.gen.dart'; | ||
|
||
class AlbumItem extends StatelessWidget { | ||
const AlbumItem({ | ||
required this.albumId, | ||
required this.name, | ||
required this.assetCount, | ||
required this.isAll, | ||
required this.isSelected, | ||
required this.onTap, | ||
super.key, | ||
}); | ||
|
||
final String albumId; | ||
final String name; | ||
final int assetCount; | ||
final bool isAll; | ||
final bool isSelected; | ||
final VoidCallback onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: onTap, | ||
child: ScreenSideOffset.small( | ||
child: Padding( | ||
padding: EdgeInsets.only(bottom: 16.0.s), | ||
child: Row( | ||
children: [ | ||
AlbumThumbnail(albumId: albumId), | ||
SizedBox(width: 12.0.s), | ||
Expanded( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
isAll ? context.i18n.gallery_albums_all_title : name, | ||
style: context.theme.appTextThemes.subtitle3, | ||
), | ||
Text( | ||
'$assetCount', | ||
style: context.theme.appTextThemes.caption2.copyWith( | ||
color: context.theme.appColors.tertararyText, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
if (isSelected) | ||
Assets.svg.iconBlockCheckboxOn.icon() | ||
else | ||
Assets.svg.iconBlockCheckboxOff.icon(color: context.theme.appColors.onTerararyFill), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
lib/app/features/gallery/views/components/albums/album_thumbnail.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: ice License 1.0 | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import 'package:ion/app/extensions/extensions.dart'; | ||
import 'package:ion/app/features/gallery/providers/gallery_provider.c.dart'; | ||
import 'package:ion/app/features/gallery/views/components/shimmer_loading_cell.dart'; | ||
import 'package:photo_manager/photo_manager.dart'; | ||
import 'package:photo_manager_image_provider/photo_manager_image_provider.dart'; | ||
|
||
class AlbumThumbnail extends ConsumerWidget { | ||
const AlbumThumbnail({required this.albumId, super.key}); | ||
|
||
final String albumId; | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final previewAsync = ref.watch(albumPreviewProvider(albumId)); | ||
|
||
return previewAsync.maybeWhen( | ||
data: (asset) { | ||
if (asset == null) { | ||
return ClipRRect( | ||
borderRadius: BorderRadius.circular(12.0.s), | ||
child: ShimmerLoadingCell(dimension: 50.0.s), | ||
); | ||
} | ||
|
||
return SizedBox.square( | ||
dimension: 50.0.s, | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(12.0.s), | ||
child: Image( | ||
image: AssetEntityImageProvider( | ||
asset, | ||
isOriginal: false, | ||
thumbnailSize: const ThumbnailSize.square(300), | ||
), | ||
fit: BoxFit.cover, | ||
), | ||
), | ||
); | ||
}, | ||
orElse: () => ClipRRect( | ||
borderRadius: BorderRadius.circular(12.0.s), | ||
child: ShimmerLoadingCell(dimension: 50.0.s), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.