refactor(mobile): immich loading overlay (#5320)

* refactor: dcm fixes

* refactor: ImmichLoadingOverlay to custom hook

* chore: dart fixes

* pr changes

* fix: process overlay add / remove in postframecallback

---------

Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
shenlong
2023-11-29 04:20:00 +00:00
committed by GitHub
parent 513f252a0c
commit 527d602a9f
12 changed files with 146 additions and 128 deletions

View File

@@ -43,6 +43,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
Widget build(BuildContext context, WidgetRef ref) {
final newAlbumTitle = ref.watch(albumViewerProvider).editTitleText;
final isEditAlbum = ref.watch(albumViewerProvider).isEditAlbum;
final isProcessing = useProcessingOverlay();
final comments = album.shared
? ref.watch(
activityStatisticsStateProvider(
@@ -52,7 +53,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
: 0;
deleteAlbum() async {
ImmichLoadingOverlayController.appLoader.show();
isProcessing.value = true;
final bool success;
if (album.shared) {
@@ -74,7 +75,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
);
}
ImmichLoadingOverlayController.appLoader.hide();
isProcessing.value = false;
}
Future<void> showConfirmationDialog() async {
@@ -122,7 +123,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
}
void onLeaveAlbumPressed() async {
ImmichLoadingOverlayController.appLoader.show();
isProcessing.value = true;
bool isSuccess =
await ref.watch(sharedAlbumProvider.notifier).leaveAlbum(album);
@@ -140,11 +141,11 @@ class AlbumViewerAppbar extends HookConsumerWidget
);
}
ImmichLoadingOverlayController.appLoader.hide();
isProcessing.value = false;
}
void onRemoveFromAlbumPressed() async {
ImmichLoadingOverlayController.appLoader.show();
isProcessing.value = true;
bool isSuccess =
await ref.watch(sharedAlbumProvider.notifier).removeAssetFromAlbum(
@@ -167,7 +168,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
);
}
ImmichLoadingOverlayController.appLoader.hide();
isProcessing.value = false;
}
void handleShareAssets(
@@ -198,9 +199,9 @@ class AlbumViewerAppbar extends HookConsumerWidget
}
void onShareAssetsTo() async {
ImmichLoadingOverlayController.appLoader.show();
isProcessing.value = true;
handleShareAssets(ref, context, selected);
ImmichLoadingOverlayController.appLoader.hide();
isProcessing.value = false;
}
buildBottomSheetActions() {