AnimatedFadeHeightSwitcher.visible constructor

AnimatedFadeHeightSwitcher.visible({
  1. required bool visible,
  2. Duration duration = const Duration(milliseconds: 350),
  3. required Widget child,
  4. bool forSliver = false,
  5. Curve? curve,
  6. double sizeAxisAlignment = -1,
  7. Axis sizeAxis = Axis.vertical,
  8. Set<AnimatedFadeHeightSwitcherEffect> effects = const {AnimatedFadeHeightSwitcherEffect.fade, AnimatedFadeHeightSwitcherEffect.size},
})

A helper UI that acts as a shortcut when implementing a widget that you want to either display or not performing this widget transition

Implementation

factory AnimatedFadeHeightSwitcher.visible({
  required bool visible,
  Duration duration = const Duration(milliseconds: 350),
  required Widget child,
  bool forSliver = false,
  Curve? curve,
  double sizeAxisAlignment = -1,
  Axis sizeAxis = Axis.vertical,
  Set<AnimatedFadeHeightSwitcherEffect> effects = const {
    AnimatedFadeHeightSwitcherEffect.fade,
    AnimatedFadeHeightSwitcherEffect.size
  },
}) {
  return AnimatedFadeHeightSwitcher(
    child: visible ? child : const SizedBox.shrink(),
    duration: duration,
    curve: Curves.easeOut,
    sizeAxisAlignment: sizeAxisAlignment,
    forSliver: forSliver,
    sizeAxis: sizeAxis,
    effects: effects,
  );
}