lerp static method

Implementation

static NeumorphicBoxShape? lerp(
    NeumorphicBoxShape? a, NeumorphicBoxShape? b, double t) {
  if (a == null && b == null) return null;

  if (t == 0.0) return a;
  if (t == 1.0) return b;

  if (a == null) {
    if (b!.isCircle || b.isRect || b.isStadium || b.isCustomPath) {
      return b;
    } else {
      return NeumorphicBoxShape.roundRect(BorderRadius.lerp(
        null,
        (b.customShapePathProvider as RRectPathProvider).borderRadius,
        t,
      )!);
    }
  }
  if (a.isCircle || a.isRect || a.isStadium || a.isCustomPath) {
    return a;
  }

  if (b == null) {
    if (a.isCircle || a.isRect || a.isStadium || a.isCustomPath) {
      return a;
    } else {
      return NeumorphicBoxShape.roundRect(BorderRadius.lerp(
        null,
        (a.customShapePathProvider as RRectPathProvider).borderRadius,
        t,
      )!);
    }
  }
  if (b.isCircle || b.isRect || b.isStadium || b.isCustomPath) {
    return b;
  }

  if (a.isBeveled && b.isBeveled) {
    return NeumorphicBoxShape.beveled(BorderRadius.lerp(
      (a.customShapePathProvider as BeveledPathProvider).borderRadius,
      (b.customShapePathProvider as BeveledPathProvider).borderRadius,
      t,
    )!);
  }

  return NeumorphicBoxShape.roundRect(BorderRadius.lerp(
    (a.customShapePathProvider as RRectPathProvider).borderRadius,
    (b.customShapePathProvider as RRectPathProvider).borderRadius,
    t,
  )!);
}