feat(mobile): Library page rework (album sorting, favorites) (#1501)

* Add album sorting

* Change AppBar to match photos page behaviour

* Add buttons

* First crude implementation of the favorites page

* Clean up

* Add favorite button

* i18n

* Add star indicator to thumbnail

* Add favorite logic to separate provider and fix favorite behavior in album

* Review feedback (Add isFavorite variable)

* dev: style buttons

* dev: styled drop down button

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Matthias Rupp
2023-02-05 04:25:11 +01:00
committed by GitHub
parent 0048662182
commit bb0b2a1f53
16 changed files with 478 additions and 56 deletions

View File

@@ -14,6 +14,8 @@ class TopControlAppBar extends HookConsumerWidget {
required this.onAddToAlbumPressed,
required this.onToggleMotionVideo,
required this.isPlayingMotionVideo,
required this.onFavorite,
required this.isFavorite,
}) : super(key: key);
final Asset asset;
@@ -22,13 +24,29 @@ class TopControlAppBar extends HookConsumerWidget {
final VoidCallback onToggleMotionVideo;
final VoidCallback onDeletePressed;
final VoidCallback onAddToAlbumPressed;
final VoidCallback onFavorite;
final Function onSharePressed;
final bool isPlayingMotionVideo;
final bool isFavorite;
@override
Widget build(BuildContext context, WidgetRef ref) {
double iconSize = 18.0;
Widget buildFavoriteButton() {
return IconButton(
iconSize: iconSize,
splashRadius: iconSize,
onPressed: () {
onFavorite();
},
icon: Icon(
isFavorite ? Icons.star : Icons.star_border,
color: Colors.grey[200],
),
);
}
return AppBar(
foregroundColor: Colors.grey[100],
backgroundColor: Colors.transparent,
@@ -43,6 +61,7 @@ class TopControlAppBar extends HookConsumerWidget {
),
),
actions: [
if (asset.isRemote) buildFavoriteButton(),
if (asset.livePhotoVideoId != null)
IconButton(
iconSize: iconSize,