lerp method Null safety

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

Linearly interpolate between ListTileThemeData objects.

Implementation

static ListTileThemeData? lerp(ListTileThemeData? a, ListTileThemeData? b, double t) {
  assert (t != null);
  if (a == null && b == null) {
    return null;
  }
  return ListTileThemeData(
    dense: t < 0.5 ? a?.dense : b?.dense,
    shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
    style: t < 0.5 ? a?.style : b?.style,
    selectedColor: Color.lerp(a?.selectedColor, b?.selectedColor, t),
    iconColor: Color.lerp(a?.iconColor, b?.iconColor, t),
    textColor: Color.lerp(a?.textColor, b?.textColor, t),
    contentPadding: EdgeInsetsGeometry.lerp(a?.contentPadding, b?.contentPadding, t),
    tileColor: Color.lerp(a?.tileColor, b?.tileColor, t),
    selectedTileColor: Color.lerp(a?.selectedTileColor, b?.selectedTileColor, t),
    horizontalTitleGap: lerpDouble(a?.horizontalTitleGap, b?.horizontalTitleGap, t),
    minVerticalPadding: lerpDouble(a?.minVerticalPadding, b?.minVerticalPadding, t),
    minLeadingWidth: lerpDouble(a?.minLeadingWidth, b?.minLeadingWidth, t),
    enableFeedback: t < 0.5 ? a?.enableFeedback : b?.enableFeedback,
    mouseCursor: t < 0.5 ? a?.mouseCursor : b?.mouseCursor,
    visualDensity: t < 0.5 ? a?.visualDensity : b?.visualDensity,
  );
}