lerp static method

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

Linearly interpolates between two styles.

Implementation

static LatexStyle? lerp(LatexStyle? a, LatexStyle? 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 LatexStyle(
    textStyle: TextStyle.lerp(a.textStyle, b.textStyle, t),
    padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
    backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
    borderRadius: Radius.lerp(a.borderRadius, b.borderRadius, t),
    scrollBlockHorizontally: t < 0.5
        ? a.scrollBlockHorizontally
        : b.scrollBlockHorizontally,
  );
}