feat(mobile): configure detail viewer asset loading (#1044)

This commit is contained in:
Fynn Petersen-Frey
2022-12-02 21:55:10 +01:00
committed by GitHub
parent da87b1256c
commit 424b11cf50
12 changed files with 138 additions and 131 deletions

View File

@@ -31,8 +31,9 @@ class GalleryViewerPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final Box<dynamic> box = Hive.box(userInfoBox);
final appSettingService = ref.watch(appSettingsServiceProvider);
final threeStageLoading = useState(false);
final settings = ref.watch(appSettingsServiceProvider);
final isLoadPreview = useState(AppSettingsEnum.loadPreview.defaultValue);
final isLoadOriginal = useState(AppSettingsEnum.loadOriginal.defaultValue);
final isZoomed = useState<bool>(false);
final indexOfAsset = useState(assetList.indexOf(asset));
final isPlayingMotionVideo = useState(false);
@@ -43,8 +44,10 @@ class GalleryViewerPage extends HookConsumerWidget {
useEffect(
() {
threeStageLoading.value = appSettingService
.getSetting<bool>(AppSettingsEnum.threeStageLoading);
isLoadPreview.value =
settings.getSetting<bool>(AppSettingsEnum.loadPreview);
isLoadOriginal.value =
settings.getSetting<bool>(AppSettingsEnum.loadOriginal);
isPlayingMotionVideo.value = false;
return null;
},
@@ -140,7 +143,8 @@ class GalleryViewerPage extends HookConsumerWidget {
isZoomedListener: isZoomedListener,
asset: assetList[index],
heroTag: assetList[index].id,
threeStageLoading: threeStageLoading.value,
loadPreview: isLoadPreview.value,
loadOriginal: isLoadOriginal.value,
);
}
} else {

View File

@@ -17,7 +17,8 @@ class ImageViewerPage extends HookConsumerWidget {
final String authToken;
final ValueNotifier<bool> isZoomedListener;
final void Function() isZoomedFunction;
final bool threeStageLoading;
final bool loadPreview;
final bool loadOriginal;
ImageViewerPage({
Key? key,
@@ -26,7 +27,8 @@ class ImageViewerPage extends HookConsumerWidget {
required this.authToken,
required this.isZoomedFunction,
required this.isZoomedListener,
required this.threeStageLoading,
required this.loadPreview,
required this.loadOriginal,
}) : super(key: key);
Asset? assetDetail;
@@ -74,7 +76,8 @@ class ImageViewerPage extends HookConsumerWidget {
child: RemotePhotoView(
asset: asset,
authToken: authToken,
threeStageLoading: threeStageLoading,
loadPreview: loadPreview,
loadOriginal: loadOriginal,
isZoomedFunction: isZoomedFunction,
isZoomedListener: isZoomedListener,
onSwipeDown: () => AutoRouter.of(context).pop(),