from static method
A wrapper for the children passed to SlotLayout to provide appropriate config information.
Acts as a delegate to the abstract class SlotLayoutConfig. It first takes a builder which returns the child Widget that SlotLayout eventually displays with an animation.
It also takes an inAnimation and outAnimation to describe how the Widget should be animated as it is switched in or out from SlotLayout. These are both defined as functions that takes a Widget and an Animation and return a Widget. These functions are passed to the AnimatedSwitcher inside SlotLayout and are to be played when the child enters/exits.
Last, it takes a required key. The key should be kept constant but unique as this key is what is used to let the SlotLayout know that a change has been made to its child.
If you define a given animation phase, there may be multiple widgets being displayed depending on the phases you have chosen to animate. If you are using GlobalKeys, this may cause issues with the AnimatedSwitcher.
See also:
- AnimatedWidget and ImplicitlyAnimatedWidget, which are commonly used as the returned widget for the inAnimation and outAnimation functions.
- AnimatedSwitcher.defaultTransitionBuilder, which is what takes the inAnimation and outAnimation.
Implementation
static SlotLayoutConfig from({
WidgetBuilder? builder,
Widget Function(Widget, Animation<double>)? inAnimation,
Widget Function(Widget, Animation<double>)? outAnimation,
Duration? duration,
required Key key,
}) =>
SlotLayoutConfig._(
builder: builder,
inAnimation: inAnimation,
outAnimation: outAnimation,
duration: duration,
key: key,
);