lerp static method

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

If both are null, returns null.

If either is null, replaced with TapSpec().

Implementation

static TapSpec? lerp(TapSpec? a, TapSpec? b, double t) {
  if (a == null && b == null) return null;
  a ??= TapSpec();
  b ??= TapSpec();
  return TapSpec(
    tappable: t < 0.5 ? a.tappable : b.tappable,
    providesFeedback: t < 0.5 ? a.providesFeedback : b.providesFeedback,
    onTap: t < 0.5 ? a.onTap : b.onTap,
    inkHighlightColor:
        Color.lerp(a.inkHighlightColor, b.inkHighlightColor, t),
    inkSplashColor: Color.lerp(a.inkSplashColor, b.inkSplashColor, t),
  );
}