diff --git a/mobile/lib/presentation/widgets/images/thumbnail.widget.dart b/mobile/lib/presentation/widgets/images/thumbnail.widget.dart index f442a6ad3c..9cf77cc29e 100644 --- a/mobile/lib/presentation/widgets/images/thumbnail.widget.dart +++ b/mobile/lib/presentation/widgets/images/thumbnail.widget.dart @@ -125,7 +125,7 @@ class _ThumbnailState extends State with SingleTickerProviderStateMix return; } - if (synchronousCall && _providerImage == null) { + if ((synchronousCall && _providerImage == null) || !_isVisible()) { _fadeController.value = 1.0; } else if (_fadeController.isAnimating) { _fadeController.forward(); @@ -201,6 +201,15 @@ class _ThumbnailState extends State with SingleTickerProviderStateMix _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 Widget build(BuildContext context) { final colorScheme = context.colorScheme;