|
| 1 | +# rive_loading |
| 2 | + |
| 3 | +[](https://pub.dartlang.org/packages/rive_loading) |
| 4 | + |
| 5 | +Loading widget based on a Rive animation, allow you to create custom loading widgets or dialogs |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +```dart |
| 10 | +RiveLoading( |
| 11 | + name: 'animation.riv', |
| 12 | + startAnimation: 'intro', |
| 13 | + loopAnimation: 'circle', |
| 14 | + endAnimation: 'end', |
| 15 | +); |
| 16 | +``` |
| 17 | + |
| 18 | +`name`: path and name of the Rive animation |
| 19 | + |
| 20 | +`until`: callback that return a future to process your initialization |
| 21 | + |
| 22 | +`isLoading`: alternative to `until` if you want to manage loading state with a boolean |
| 23 | + |
| 24 | +`loopAnimation`: animation name to run in loop |
| 25 | + |
| 26 | +`endAnimation`: animation name to run once `until` is complete or `isLoading` false |
| 27 | + |
| 28 | +`startAnimation`: animation name to run once as start |
| 29 | + |
| 30 | +`height`: force the height of the Rive animation, by default it take the all place available |
| 31 | + |
| 32 | +`width`: force the width of the Rive animation, by default it take the all place available |
| 33 | + |
| 34 | +`alignment`: alignment of the Rive animation, center by default |
| 35 | + |
| 36 | +`onSuccess` callback called when the animation is finished and `isLoading` is false or `until` is complete |
| 37 | + |
| 38 | +`onError` callback called `until` has failed |
| 39 | + |
| 40 | +## Available mode |
| 41 | + |
| 42 | +### Only one animation |
| 43 | +Basically you have one animation to show and then just need to stay at last frame. In order to do that only specify the `startAnimation` |
| 44 | + |
| 45 | +### Start and loop animation |
| 46 | +Your animation have an intro and a loop state, in order to do that only specify the `startAnimation` and `loopAnimation` |
| 47 | + |
| 48 | +### End and loop animation |
| 49 | +Your animation have a finish and a loop state, in order to do that only specify the `endAnimation` and `loopAnimation` |
| 50 | + |
| 51 | +### Start and end animation |
| 52 | +Your animation have an intro and a finish that should stay on the last frame, in order to do that only `startAnimation` and `endAnimation` |
| 53 | + |
| 54 | +### Start, end and loop animation |
| 55 | +Your animation have an intro, a finish and a loop state, in order to do that specify the `startAnimation`, `endAnimation` and `loopAnimation` |
0 commit comments