lerp static method

Linearly interpolate between two RowTooltipThemes.

Non-interpolable fields snap at t = 0.5, as the other themes do.

Implementation

static RowTooltipTheme lerp(
  RowTooltipTheme? a,
  RowTooltipTheme? b,
  double t,
) {
  if (a == null && b == null) return const RowTooltipTheme();
  if (a == null) return b!;
  if (b == null) return a;

  return RowTooltipTheme(
    direction: t < 0.5 ? a.direction : b.direction,
    alignment: t < 0.5 ? a.alignment : b.alignment,
    offset: lerpDouble(a.offset, b.offset, t) ?? 8.0,
    crossAxisOffset:
        lerpDouble(a.crossAxisOffset, b.crossAxisOffset, t) ?? 0.0,
    screenMargin: lerpDouble(a.screenMargin, b.screenMargin, t) ?? 8.0,
    surface: t < 0.5 ? a.surface : b.surface,
    interactive: t < 0.5 ? a.interactive : b.interactive,
    waitDuration: t < 0.5 ? a.waitDuration : b.waitDuration,
    showDuration: t < 0.5 ? a.showDuration : b.showDuration,
    enableHover: t < 0.5 ? a.enableHover : b.enableHover,
    animation: t < 0.5 ? a.animation : b.animation,
    animationCurve: t < 0.5 ? a.animationCurve : b.animationCurve,
    animationDuration: t < 0.5 ? a.animationDuration : b.animationDuration,
    fadeBegin: lerpDouble(a.fadeBegin, b.fadeBegin, t) ?? 0.0,
    scaleBegin: lerpDouble(a.scaleBegin, b.scaleBegin, t) ?? 0.0,
    slideOffset: lerpDouble(a.slideOffset, b.slideOffset, t) ?? 0.3,
    rotationBegin: lerpDouble(a.rotationBegin, b.rotationBegin, t) ?? -0.05,
    onShow: t < 0.5 ? a.onShow : b.onShow,
    onHide: t < 0.5 ? a.onHide : b.onHide,
  );
}