lerp static method

Linearly interpolates between two inline code styles.

Implementation

static InlineCodeStyle? lerp(
  InlineCodeStyle? a,
  InlineCodeStyle? b,
  double t,
) {
  if (a == null && b == null) {
    return null;
  }
  if (a == null) {
    return t < 0.5 ? null : b;
  }
  if (b == null) {
    return t < 0.5 ? a : null;
  }
  return InlineCodeStyle(
    fontFamily: t < 0.5 ? a.fontFamily : b.fontFamily,
    fontFamilyPackage: t < 0.5 ? a.fontFamilyPackage : b.fontFamilyPackage,
    fontFamilyFallback: t < 0.5 ? a.fontFamilyFallback : b.fontFamilyFallback,
    fontSizeFactor: ui.lerpDouble(a.fontSizeFactor, b.fontSizeFactor, t),
    fontWeight: FontWeight.lerp(a.fontWeight, b.fontWeight, t),
    color: Color.lerp(a.color, b.color, t),
    backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
    borderColor: Color.lerp(a.borderColor, b.borderColor, t),
    borderWidth: ui.lerpDouble(a.borderWidth, b.borderWidth, t),
    borderRadius: Radius.lerp(a.borderRadius, b.borderRadius, t),
    padding: EdgeInsets.lerp(a.padding, b.padding, t),
    boxHeightStyle: t < 0.5 ? a.boxHeightStyle : b.boxHeightStyle,
  );
}