lerp static method

Linearly interpolate between two FolderViewIconThemes

Implementation

static FolderViewIconTheme lerp(
  FolderViewIconTheme? a,
  FolderViewIconTheme? b,
  double t,
) {
  if (a == null && b == null) {
    return const FolderViewIconTheme();
  }
  if (a == null) return b!;
  if (b == null) return a;

  return FolderViewIconTheme(
    iconSize: (a.iconSize + (b.iconSize - a.iconSize) * t),
    iconColor: Color.lerp(a.iconColor, b.iconColor, t),
    selectedIconColor:
        Color.lerp(a.selectedIconColor, b.selectedIconColor, t),
    folderIcon: t < 0.5 ? a.folderIcon : b.folderIcon,
    folderOpenIcon: t < 0.5 ? a.folderOpenIcon : b.folderOpenIcon,
    parentIcon: t < 0.5 ? a.parentIcon : b.parentIcon,
    parentOpenIcon: t < 0.5 ? a.parentOpenIcon : b.parentOpenIcon,
    childIcon: t < 0.5 ? a.childIcon : b.childIcon,
    expandIcon: t < 0.5 ? a.expandIcon : b.expandIcon,
  );
}