lerp static method

Linearly interpolate between two FolderViewScrollbarThemes

Implementation

static FolderViewScrollbarTheme lerp(
  FolderViewScrollbarTheme? a,
  FolderViewScrollbarTheme? b,
  double t,
) {
  if (a == null && b == null) {
    return FolderViewScrollbarTheme(
      thumbColor: const Color(0xFFFF0000),
      trackColor: const Color(0xFFEEEEEE),
    );
  }
  if (a == null) return b!;
  if (b == null) return a;

  return FolderViewScrollbarTheme(
    thumbColor: Color.lerp(a.thumbColor, b.thumbColor, t)!,
    trackColor: Color.lerp(a.trackColor, b.trackColor, t)!,
    thickness: lerpDouble(a.thickness, b.thickness, t),
    radius: lerpDouble(a.radius, b.radius, t),
    thumbVisibility: t < 0.5 ? a.thumbVisibility : b.thumbVisibility,
    hoverOpacity: lerpDouble(a.hoverOpacity, b.hoverOpacity, t),
    nonHoverOpacity: lerpDouble(a.nonHoverOpacity, b.nonHoverOpacity, t),
    hoverAnimationDuration:
        t < 0.5 ? a.hoverAnimationDuration : b.hoverAnimationDuration,
    trackWidth: lerpDouble(a.trackWidth, b.trackWidth, t),
    trackRadius: lerpDouble(a.trackRadius, b.trackRadius, t),
    trackVisibility: t < 0.5 ? a.trackVisibility : b.trackVisibility,
  );
}