Skip to main content

Examples

NeoRotation(
  isRotating: isLoading.value, // Using hooks
  child: PhosphorIcon(
    PhosphorIconsRegular.spinner,
    color: theme.colors.fgBrand,
    size: 24,
  ),
),

Properties

Required

isRotating
bool
required
Controls whether the rotation animation is active. When true, the child rotates continuously. When false, rotation stops with a smooth spring animation to the nearest complete rotation.
child
Widget
required
The widget to apply rotation animation to. This can be any widget including Icons, Containers, or complex widget trees.

Animation Behavior

Continuous Rotation

When isRotating is true, the widget rotates continuously at a steady pace (360° per second).

Spring Stop Animation

When isRotating changes from true to false, the rotation doesn’t stop abruptly. Instead, it uses a physics-based spring animation to smoothly decelerate to the nearest complete rotation (0°, 90°, 180°, or 270°).

Best Practices

  • Can be combined nicely with loading indicators like PhosphorIcons.spinner, PhosphorIcons.circleNotch, PhosphorIcons.arrowsClockwise etc

Integration Notes

  • Works seamlessly with any widget, including complex widget trees
  • The widget handles smooth transitions when isRotating state changes rapidly
I