Skip to content

Commit

Permalink
chore: rebase on main
Browse files Browse the repository at this point in the history
  • Loading branch information
shenlong-tanwen committed Feb 16, 2024
1 parent 34caa39 commit 6e77e5d
Showing 1 changed file with 2 additions and 60 deletions.
62 changes: 2 additions & 60 deletions mobile/lib/shared/ui/immich_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,64 +101,6 @@ class ImmichImage extends StatefulWidget {
static bool useLocal(Asset asset) =>
!asset.isRemote ||
asset.isLocal && !Store.get(StoreKey.preferRemoteImage, false);
@override
Widget build(BuildContext context) {

if (asset == null) {
return Container(
decoration: const BoxDecoration(
color: Colors.grey,
),
child: SizedBox(
width: width,
height: height,
child: const Center(
child: Icon(Icons.no_photography),
),
),
);
}

return OctoImage(
fadeInDuration: const Duration(milliseconds: 0),
fadeOutDuration: const Duration(milliseconds: 400),
placeholderBuilder: (context) {
if (useGrayBoxPlaceholder) {
// Use the gray box placeholder
return const SizedBox.expand(
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.grey),
),
);
}
// No placeholder
return const SizedBox();
},
image: ImmichImage.imageProvider(
asset: asset,
isThumbnail: isThumbnail,
),
width: width,
height: height,
fit: fit,
errorBuilder: (context, error, stackTrace) {
if (error is PlatformException &&
error.code == "The asset not found!") {
debugPrint(
"Asset ${asset?.localId} does not exist anymore on device!",
);
} else {
debugPrint(
"Error getting thumb for assetId=${asset?.localId}: $error",
);
}
return Icon(
Icons.image_not_supported_outlined,
color: context.primaryColor,
);
},
);
}
}

/// Renders an Asset using local data if available, else remote data
Expand Down Expand Up @@ -197,8 +139,8 @@ class _ImmichImageState extends State<ImmichImage> {
final Asset asset = widget.asset!;

return OctoImage(
fadeInDuration: const Duration(milliseconds: 200),
fadeOutDuration: const Duration(milliseconds: 200),
fadeInDuration: const Duration(milliseconds: 0),
fadeOutDuration: const Duration(milliseconds: 400),
placeholderBuilder: (context) {
if (thumbHashBytes != null && widget.isThumbnail) {
// Use the blurhash placeholder
Expand Down

0 comments on commit 6e77e5d

Please sign in to comment.