lerp static method

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

Linearly interpolates between two styles.

Implementation

static ImageStyle? lerp(ImageStyle? a, ImageStyle? 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 ImageStyle(
    borderRadius: Radius.lerp(a.borderRadius, b.borderRadius, t),
    padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
    fit: t < 0.5 ? a.fit : b.fit,
    maxWidth: lerpDouble(a.maxWidth, b.maxWidth, t),
    maxHeight: lerpDouble(a.maxHeight, b.maxHeight, t),
  );
}