lerpStep static method

Widget lerpStep(
  1. Widget a,
  2. Widget b,
  3. double t, {
  4. AlignmentGeometry alignment = Alignment.center,
})

Creates an instant transition between two widgets without animation.

This lerp function provides a step-wise transition where both widgets are shown simultaneously without any fade effect. At t=0.0, widget a is returned; at t=1.0, widget b is returned; for intermediate values, both widgets are stacked.

Parameters:

  • a (Widget): The first widget in the transition.
  • b (Widget): The second widget in the transition.
  • t (double): Animation progress from 0.0 to 1.0.
  • alignment (AlignmentGeometry): How to align widgets (unused in step mode).

Returns either individual widget at extremes or a Stack for intermediate values.

Implementation

static Widget lerpStep(Widget a, Widget b, double t,
    {AlignmentGeometry alignment = Alignment.center}) {
  if (t == 0) {
    return a;
  } else if (t == 1) {
    return b;
  }
  return Stack(
    fit: StackFit.passthrough,
    children: [
      a,
      b,
    ],
  );
}