lerp static method

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

Linearly interpolate between two MenuStyles.

Implementation

static MenuStyle? lerp(MenuStyle? a, MenuStyle? b, double t) {
  if (identical(a, b)) {
    return a;
  }
  return MenuStyle(
    backgroundColor: MaterialStateProperty.lerp<Color?>(a?.backgroundColor, b?.backgroundColor, t, Color.lerp),
    shadowColor: MaterialStateProperty.lerp<Color?>(a?.shadowColor, b?.shadowColor, t, Color.lerp),
    surfaceTintColor: MaterialStateProperty.lerp<Color?>(a?.surfaceTintColor, b?.surfaceTintColor, t, Color.lerp),
    elevation: MaterialStateProperty.lerp<double?>(a?.elevation, b?.elevation, t, lerpDouble),
    padding:  MaterialStateProperty.lerp<EdgeInsetsGeometry?>(a?.padding, b?.padding, t, EdgeInsetsGeometry.lerp),
    minimumSize: MaterialStateProperty.lerp<Size?>(a?.minimumSize, b?.minimumSize, t, Size.lerp),
    fixedSize: MaterialStateProperty.lerp<Size?>(a?.fixedSize, b?.fixedSize, t, Size.lerp),
    maximumSize: MaterialStateProperty.lerp<Size?>(a?.maximumSize, b?.maximumSize, t, Size.lerp),
    side: MaterialStateBorderSide.lerp(a?.side, b?.side, t),
    shape: MaterialStateProperty.lerp<OutlinedBorder?>(a?.shape, b?.shape, t, OutlinedBorder.lerp),
    mouseCursor: t < 0.5 ? a?.mouseCursor : b?.mouseCursor,
    visualDensity: t < 0.5 ? a?.visualDensity : b?.visualDensity,
    alignment: AlignmentGeometry.lerp(a?.alignment, b?.alignment, t),
  );
}