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,
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,
message: t < 0.5 ? a.message : b.message,
textStyle: TextStyle.lerp(a.textStyle, b.textStyle, t),
tooltipBuilder: t < 0.5 ? a.tooltipBuilder : b.tooltipBuilder,
tooltipBuilderResolver:
t < 0.5 ? a.tooltipBuilderResolver : b.tooltipBuilderResolver,
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
elevation: lerpDouble(a.elevation, b.elevation, t),
boxShadow: BoxShadow.lerpList(a.boxShadow ?? [], b.boxShadow ?? [], t),
borderRadius: BorderRadius.lerp(a.borderRadius, b.borderRadius, t),
padding: EdgeInsets.lerp(a.padding, b.padding, t),
controller: t < 0.5 ? a.controller : b.controller,
enableTap: t < 0.5 ? a.enableTap : b.enableTap,
enableHover: t < 0.5 ? a.enableHover : b.enableHover,
animationDuration: t < 0.5 ? a.animationDuration : b.animationDuration,
onShow: t < 0.5 ? a.onShow : b.onShow,
onHide: t < 0.5 ? a.onHide : b.onHide,
interactive: t < 0.5 ? a.interactive : b.interactive,
waitDuration: t < 0.5 ? a.waitDuration : b.waitDuration,
showDuration: t < 0.5 ? a.showDuration : b.showDuration,
borderColor: Color.lerp(a.borderColor, b.borderColor, t),
borderWidth: lerpDouble(a.borderWidth, b.borderWidth, t),
showArrow: t < 0.5 ? a.showArrow : b.showArrow,
arrowBaseWidth: lerpDouble(a.arrowBaseWidth, b.arrowBaseWidth, t),
arrowLength: lerpDouble(a.arrowLength, b.arrowLength, t),
arrowPositionRatio:
lerpDouble(a.arrowPositionRatio, b.arrowPositionRatio, t),
screenMargin: lerpDouble(a.screenMargin, b.screenMargin, t),
animation: t < 0.5 ? a.animation : b.animation,
animationCurve: t < 0.5 ? a.animationCurve : b.animationCurve,
fadeBegin: lerpDouble(a.fadeBegin, b.fadeBegin, t),
scaleBegin: lerpDouble(a.scaleBegin, b.scaleBegin, t),
slideOffset: lerpDouble(a.slideOffset, b.slideOffset, t),
rotationBegin: lerpDouble(a.rotationBegin, b.rotationBegin, t),
);
}