From 9bdde04758f4b557836349f47ae597fb11ca4f55 Mon Sep 17 00:00:00 2001 From: Grant Skinner Date: Sun, 15 May 2022 15:38:57 -0600 Subject: [PATCH] Fix an issue in some layouts with no placeholder --- lib/image_fade.dart | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/image_fade.dart b/lib/image_fade.dart index 2c04b69..69c5dce 100644 --- a/lib/image_fade.dart +++ b/lib/image_fade.dart @@ -257,17 +257,17 @@ class _ImageFadeState extends State with TickerProviderStateMixin { ); } + List kids = []; + if (widget.placeholder != null) kids.add(widget.placeholder!); + if (back != null) kids.add(back); + if (front != null) kids.add(front); + Widget content = Container( width: widget.width, height: widget.height, - child: Stack( - fit: StackFit.passthrough, - children: [ - if (widget.placeholder != null) widget.placeholder!, - if (back != null) back, - if (front != null) front, - ], - ), + child: kids.isEmpty + ? null + : Stack(fit: StackFit.passthrough, children: kids), ); if (widget.excludeFromSemantics) return content;