mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-20 20:56:31 -07:00
chore: Lots of bug fixes and navigation improvements
This commit is contained in:
parent
9bb5e81812
commit
92d5391b93
35 changed files with 513 additions and 455 deletions
|
|
@ -90,7 +90,13 @@ class _PhotoViewerScreenState extends ConsumerState<PhotoViewerScreen> with Widg
|
|||
|
||||
if (context.mounted) {
|
||||
setState(() {
|
||||
photos = {...photos, ...newItems}.toList();
|
||||
if (photos.length == 1 && newItems.contains(photos.first)) {
|
||||
photos = newItems;
|
||||
currentPage = photos.indexWhere((value) => value.id == widget.selected).clamp(0, photos.length - 1);
|
||||
controller.jumpToPage(currentPage);
|
||||
} else {
|
||||
photos = {...photos, ...newItems}.toList();
|
||||
}
|
||||
loadingItems = false;
|
||||
});
|
||||
}
|
||||
|
|
@ -165,14 +171,14 @@ class _PhotoViewerScreenState extends ConsumerState<PhotoViewerScreen> with Widg
|
|||
? Center(
|
||||
child: Text(context.localized.noItemsToShow),
|
||||
)
|
||||
: buildViewer(),
|
||||
: buildViewer(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildViewer() {
|
||||
Widget buildViewer(BuildContext context) {
|
||||
final currentPhoto = photos[currentPage];
|
||||
final imageHash = currentPhoto.images?.primary?.hash;
|
||||
return Stack(
|
||||
|
|
@ -498,8 +504,8 @@ class _PhotoViewerScreenState extends ConsumerState<PhotoViewerScreen> with Widg
|
|||
},
|
||||
);
|
||||
|
||||
void markAsFavourite(PhotoModel photo, {bool? value}) {
|
||||
ref.read(userProvider.notifier).setAsFavorite(value ?? !photo.userData.isFavourite, photo.id);
|
||||
Future<void> markAsFavourite(PhotoModel photo, {bool? value}) async {
|
||||
await ref.read(userProvider.notifier).setAsFavorite(value ?? !photo.userData.isFavourite, photo.id);
|
||||
|
||||
setState(() {
|
||||
int index = photos.indexOf(photo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue