lerp static method

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

Linearly interpolates between two alert styles.

Implementation

static AlertStyle? lerp(AlertStyle? a, AlertStyle? 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 AlertStyle(
    color: Color.lerp(a.color, b.color, t),
    backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
    icon: t < 0.5 ? a.icon : b.icon,
    iconSize: lerpDouble(a.iconSize, b.iconSize, t),
    showIcon: t < 0.5 ? a.showIcon : b.showIcon,
    title: t < 0.5 ? a.title : b.title,
    titleStyle: TextStyle.lerp(a.titleStyle, b.titleStyle, t),
    titleGap: lerpDouble(a.titleGap, b.titleGap, t),
    textStyle: TextStyle.lerp(a.textStyle, b.textStyle, t),
    barWidth: lerpDouble(a.barWidth, b.barWidth, t),
    borderRadius: Radius.lerp(a.borderRadius, b.borderRadius, t),
    padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
    margin: EdgeInsetsGeometry.lerp(a.margin, b.margin, t),
    note: lerp(a.note, b.note, t),
    tip: lerp(a.tip, b.tip, t),
    important: lerp(a.important, b.important, t),
    warning: lerp(a.warning, b.warning, t),
    caution: lerp(a.caution, b.caution, t),
  );
}