AnimatedBetween.showHide constructor

const AnimatedBetween.showHide({
  1. Key? key,
  2. required bool show,
  3. required Widget child,
  4. Duration fadeDuration = defaultFadeDurationShowHide,
  5. double sizeDurationFactor = defaultSizeDurationFactorShowHide,
  6. Curve fadeCurve = Curves.easeInOut,
  7. Curve sizeCurve = defaultSizeCurve,
  8. Alignment alignment = Alignment.topCenter,
  9. Clip clipBehavior = Clip.none,
  10. AnimatedBetweenMode mode = AnimatedBetweenMode.fit,
  11. bool printDebug = true,
})

Convenience constructor that animates a single widget in and out.

When show is true the child is animated in; when show is false the child is treated as null and the box animates down to zero size. The grow/shrink model described in the class documentation applies: showing grows, hiding shrinks.

Implementation

const AnimatedBetween.showHide({
  super.key,
  required bool show,
  required Widget child,
  this.fadeDuration = defaultFadeDurationShowHide,
  this.sizeDurationFactor = defaultSizeDurationFactorShowHide,
  this.fadeCurve = Curves.easeInOut,
  this.sizeCurve = defaultSizeCurve,
  this.alignment = Alignment.topCenter,
  this.clipBehavior = Clip.none,
  AnimatedBetweenMode mode = AnimatedBetweenMode.fit,
  this.printDebug = true,
}) : assert(sizeDurationFactor >= 1.0, 'sizeDurationFactor must be >= 1.0'),
     modeLargerChild = mode,
     modeShorterChild = AnimatedBetweenMode.fit,
     child = show ? child : null;