diff --git a/Runtime/Widgets/AnimatedCrossFade.cs b/Runtime/Widgets/AnimatedCrossFade.cs index 8398848..557f839 100644 --- a/Runtime/Widgets/AnimatedCrossFade.cs +++ b/Runtime/Widgets/AnimatedCrossFade.cs @@ -10,6 +10,7 @@ public class AnimatedCrossFade : StatefulWidget public float Duration { get; set; } = 0f; public float? ReverseDuration { get; set; } = null; public Alignment Alignment { get; set; } = Alignment.Center; + public bool KeepMounted { get; set; } = false; public override State CreateState() => new AnimatedCrossFadeState(); @@ -38,6 +39,11 @@ public override void InitState() _firstChild = CreateChild(context => { + if (!Widget.KeepMounted && _controller.IsCompleted) + { + return new Empty(); + } + return new CompositeTransition { Key = _firstKey, @@ -47,6 +53,11 @@ public override void InitState() }); _secondChild = CreateChild(context => { + if (!Widget.KeepMounted && _controller.IsDismissed) + { + return new Empty(); + } + return new CompositeTransition { Key = _secondKey,