Created
October 20, 2025 18:30
-
-
Save fredgrott/1bf2c3e6ebe03dbafe1de11710410120 to your computer and use it in GitHub Desktop.
motor, sequence animation widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'pacakge:motor/motor.dart'; | |
| enum LoadingState { idle, spinning, complete } | |
| SequenceMotionBuilder<LoadingState, double>( | |
| sequence: .states({ | |
| .idle: 0.0, | |
| .spinning: 2 * pi, | |
| .complete: 2 * pi, | |
| }, motion: .smoothSpring()), | |
| converter: .single, | |
| playing: true, // Auto-progress through phases | |
| currentPhase: currentState, // Or control manually | |
| onTransition: (transition) => print('Now in transition: $transition'), | |
| builder: (context, rotation, phase, child) { | |
| return Transform.rotate( | |
| angle: rotation, | |
| child: Icon( | |
| phase == .complete ? Icons.check : Icons.refresh, | |
| color: phase == .complete ? Colors.green : Colors.blue, | |
| ), | |
| ); | |
| }, | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment