mirror of
https://github.com/immich-app/immich.git
synced 2025-11-04 11:33:11 -05:00
fix(mobile): skip animation for offscreen thumbnails (#21277)
This commit is contained in:
parent
e67265cef2
commit
5405810a38
@ -125,7 +125,7 @@ class _ThumbnailState extends State<Thumbnail> with SingleTickerProviderStateMix
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (synchronousCall && _providerImage == null) {
|
if ((synchronousCall && _providerImage == null) || !_isVisible()) {
|
||||||
_fadeController.value = 1.0;
|
_fadeController.value = 1.0;
|
||||||
} else if (_fadeController.isAnimating) {
|
} else if (_fadeController.isAnimating) {
|
||||||
_fadeController.forward();
|
_fadeController.forward();
|
||||||
@ -201,6 +201,15 @@ class _ThumbnailState extends State<Thumbnail> with SingleTickerProviderStateMix
|
|||||||
_loadFromThumbhashProvider();
|
_loadFromThumbhashProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isVisible() {
|
||||||
|
final renderObject = context.findRenderObject() as RenderBox?;
|
||||||
|
if (renderObject == null || !renderObject.attached) return false;
|
||||||
|
|
||||||
|
final topLeft = renderObject.localToGlobal(Offset.zero);
|
||||||
|
final bottomRight = renderObject.localToGlobal(Offset(renderObject.size.width, renderObject.size.height));
|
||||||
|
return topLeft.dy < context.height && bottomRight.dy > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final colorScheme = context.colorScheme;
|
final colorScheme = context.colorScheme;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user