slide method

GetAnimatedBuilder slide({
  1. required OffsetBuilder offset,
  2. double begin = 0,
  3. double end = 1,
  4. Duration duration = _defaultDuration,
  5. Duration delay = _defaultDelay,
  6. ValueSetter<AnimationController>? onComplete,
  7. bool isSequential = false,
  8. bool autoPlayOnUpdate = false,
})

Translates/slides the widget dynamically using an offset builder.

The offset callback is invoked on every animation frame with the current tweened value (interpolated from begin to end) as its second parameter, and must use that value to produce the translation for that frame. Returning a constant Offset results in no visible motion.

// Slides the widget 25 logical pixels downward.
Text('Hello').slide(
  offset: (context, value) => Offset(0, 25 * value),
);
  • offset Callback that builds the slide offset from the current animation value.
  • begin Starting interpolation value.
  • end Ending interpolation value.
  • duration The duration of the slide transition.
  • delay The delay duration before sliding starts.
  • onComplete A callback triggered when the animation completes.
  • isSequential If true, starts this animation after the previous one in the chain completes.
  • autoPlayOnUpdate If true, replays the animation when rebuilt with a different tween.

Implementation

GetAnimatedBuilder slide({
  required OffsetBuilder offset,
  double begin = 0,
  double end = 1,
  Duration duration = _defaultDuration,
  Duration delay = _defaultDelay,
  ValueSetter<AnimationController>? onComplete,
  bool isSequential = false,
  bool autoPlayOnUpdate = false,
}) {
  return SlideAnimation(
    duration: duration,
    delay: _getDelay(isSequential, delay),
    begin: begin,
    end: end,
    onComplete: onComplete,
    offsetBuild: offset,
    autoPlayOnUpdate: autoPlayOnUpdate,
    child: this,
  );
}