https://github.com/alnitak/yoda
Flutter widget that let you slice any kind of child widget in a matrix of tiles and animate them in different kind of ways. Currently with Explode, Vortex, and Flakes. Works on all platforms.
https://github.com/alnitak/yoda
android dart desktop flutter flutter-widget ios web widget
Last synced: about 1 year ago
JSON representation
Flutter widget that let you slice any kind of child widget in a matrix of tiles and animate them in different kind of ways. Currently with Explode, Vortex, and Flakes. Works on all platforms.
- Host: GitHub
- URL: https://github.com/alnitak/yoda
- Owner: alnitak
- License: apache-2.0
- Created: 2021-04-07T21:06:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-05T10:21:44.000Z (almost 2 years ago)
- Last Synced: 2025-04-23T04:13:08.913Z (about 1 year ago)
- Topics: android, dart, desktop, flutter, flutter-widget, ios, web, widget
- Language: Dart
- Homepage:
- Size: 10.7 MB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Yoda Flutter plugin
Flutter widget that let's you slice any kind of child widget in a matrix of tiles and animate them with different kind of ways. Currently with Explode, Vortex and Flakes.
Works on all platforms.

## Yoda Widget Properties
##### Yoda widget
* [**yodaEffect**] Animation effect to use (see below).
* [**controller**] Animation controller.
* [**duration**] Animation duration.
* [**startWhenTapped**] Enable tap gesture to start animation.
* [**animParameters**] Parameters used to animate tiles (see below).
* [**child**] Whatever widget to slice.
##### YodaEffect enum
* [**Explosion**]
* [**Vortex**]
* [**Flakes**]
##### AnimParameters properties
* [**yodaBarrier**] Define which edges are barraged (see below).
* [**hTiles**] Number of horizontal tiles to divide the child widget.
* [**vTiles**] Number of vertical tiles to divide the child widget.
* [**fractionalCenter**] Default center where force is given when not tapping on it.
* [**gravity**] Vertical force.
* [**effectPower**] Effect strength.
* [**blurPower**] Blur strength.
* [**randomness**] Random strength.
##### YodaBarrier properties
* [**left**] Block tiles moving over the left edge.
* [**right**] Block tiles moving over the right edge.
* [**top**] Block tiles moving over the top edge.
* [**bottom**] Block tiles moving over the bottom edge.
## How to use
If you need to control the animation status:
```dart
late YodaController _yodaControllerExplode;
@override
void initState() {
super.initState();
_yodaControllerExplode = YodaController()
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
_yodaControllerExplode.reset();
}
});
}
```
YodaController accepts start() and reset() methods.
Note: calling those methods will not work when a setState() is called at the same time.
```dart
Yoda(
yodaEffect: YodaEffect.Explosion,
controller: _yodaControllerExplode,
duration: Duration(milliseconds: 2500),
animParameters: AnimParameters(
yodaBarrier: YodaBarrier(bottom: true, left: true, right: true),
fractionalCenter: Offset(0.5, 1.0),
hTiles: 20,
vTiles: 20,
effectPower: 0.2,
blurPower: 5,
gravity: 0.1,
randomness: 30,
),
startWhenTapped: true,
child: SizedBox(
width: 250,
height: 180,
child: Image.asset('assets/dash.png', fit: BoxFit.fill)
)
)
```
----
##### TODO
- Find a better way to capture the widget
- When changing Yoda widget parameters, 2 hot reloads are needed to make it to work!