lerp<T> static method

Linearly interpolate between two NodeTooltipThemes

Implementation

static NodeTooltipTheme<T> lerp<T>(
  NodeTooltipTheme<T>? a,
  NodeTooltipTheme<T>? b,
  double t,
) {
  if (a == null && b == null) {
    return const NodeTooltipTheme();
  }
  if (a == null) return b!;
  if (b == null) return a;

  return NodeTooltipTheme<T>(
    useTooltip: t < 0.5 ? a.useTooltip : b.useTooltip,
    position: t < 0.5 ? a.position : b.position,
    margin: t < 0.5 ? a.margin : b.margin,
    verticalOffset: lerpDouble(a.verticalOffset, b.verticalOffset, t) ?? 20.0,
    waitDuration: t < 0.5 ? a.waitDuration : b.waitDuration,
    message: t < 0.5 ? a.message : b.message,
    textStyle: TextStyle.lerp(a.textStyle, b.textStyle, t),
    richMessage: t < 0.5 ? a.richMessage : b.richMessage,
    richMessageResolver:
        t < 0.5 ? a.richMessageResolver : b.richMessageResolver,
    backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
    boxShadow: t < 0.5 ? a.boxShadow : b.boxShadow,
  );
}