lerp static method

ScrollbarThemeData lerp(
  1. ScrollbarThemeData? a,
  2. ScrollbarThemeData? b,
  3. double t
)

Linearly interpolate between two Scrollbar themes.

The t argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning a (or something equivalent to a), 1.0 meaning that the interpolation has finished, returning b (or something equivalent to b), and values in between meaning that the interpolation is at the relevant point on the timeline between a and b. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves such as Curves.elasticInOut).

Values for t are usually obtained from an Animation<double>, such as an AnimationController.

Implementation

static ScrollbarThemeData lerp(ScrollbarThemeData? a, ScrollbarThemeData? b, double t) {
  if (identical(a, b) && a != null) {
    return a;
  }
  return ScrollbarThemeData(
    thumbVisibility: MaterialStateProperty.lerp<bool?>(a?.thumbVisibility, b?.thumbVisibility, t, _lerpBool),
    thickness: MaterialStateProperty.lerp<double?>(a?.thickness, b?.thickness, t, lerpDouble),
    trackVisibility: MaterialStateProperty.lerp<bool?>(a?.trackVisibility, b?.trackVisibility, t, _lerpBool),
    showTrackOnHover: _lerpBool(a?.showTrackOnHover, b?.showTrackOnHover, t),
    interactive: _lerpBool(a?.interactive, b?.interactive, t),
    radius: Radius.lerp(a?.radius, b?.radius, t),
    thumbColor: MaterialStateProperty.lerp<Color?>(a?.thumbColor, b?.thumbColor, t, Color.lerp),
    trackColor: MaterialStateProperty.lerp<Color?>(a?.trackColor, b?.trackColor, t, Color.lerp),
    trackBorderColor: MaterialStateProperty.lerp<Color?>(a?.trackBorderColor, b?.trackBorderColor, t, Color.lerp),
    crossAxisMargin: lerpDouble(a?.crossAxisMargin, b?.crossAxisMargin, t),
    mainAxisMargin: lerpDouble(a?.mainAxisMargin, b?.mainAxisMargin, t),
    minThumbLength: lerpDouble(a?.minThumbLength, b?.minThumbLength, t),
  );
}