lerp static method

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

Linearly interpolates between two styles.

Implementation

static LinkStyle? lerp(LinkStyle? a, LinkStyle? 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 LinkStyle(
    color: Color.lerp(a.color, b.color, t),
    hoverColor: Color.lerp(a.hoverColor, b.hoverColor, t),
    decoration: t < 0.5 ? a.decoration : b.decoration,
    decorationThickness: lerpDouble(
      a.decorationThickness,
      b.decorationThickness,
      t,
    ),
    fontWeight: FontWeight.lerp(a.fontWeight, b.fontWeight, t),
  );
}