mationani 0.0.30 copy "mationani: ^0.0.30" to clipboard
mationani: ^0.0.30 copied to clipboard

create animation by stateless widget

see mationani in Pub.dev and Github

To prevent scattered instances of AnimationController, Animation, Tween in multiple widgets; there is a stateful widget called Mationani, empowering us to have an easy way to create animation. With Matoinani, we can only create widgets in a build.

In tradition, an animation needs a stateful widget with ticker mixin.

class SampleSlide extends StatefulWidget {
  const SampleSlide({super.key});

  @override
  State<SampleSlide> createState() => _SampleSlideState();
}

class _SampleSlideState extends State<SampleSlide> with SingleTickerProviderStateMixin {
  late final AnimationController controller;
  late final Animation<Offset> animation;

  @override
  void initState() {
    controller = AnimationController(vsync: this, duration: const Duration(seconds: 1));
    animation = controller.drive(Tween(begin: Offset.zero, end: Offset(1, 1)));
    controller.forward();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SlideTransition(
      position: animation,
      child: CircularProgressIndicator(),
    );
  }
}

With Mationani, creating animation needs only Mation and Ani as argument.

class SampleSlide extends StatelessWidget {
  const SampleSlide({super.key});

  @override
  Widget build(BuildContext context) {
    return Mationani(
      ani: Ani(
        style: AnimationStyle(duration: Duration(seconds: 1)),
        initializer: Ani.initializeForward,
      ),
      mation: MamionTransition.slide(Between(Offset.zero, Offset(1, 1))),
      child: CircularProgressIndicator(),
    );
  }
}

this is a library aims to integrate flutter animation and not limited to built-in animation; for example, talks to MamionTransition.fade and MamionTransition.slide, there is FadeTransition and SlideTransition; talks to MamionClipper or MamionPainter, there is no pertinent widget if ClipPath or CustomPaint is not. whether there is a flutter animation widget or not, hopes there are more implementation in the future!

2
likes
0
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

create animation by stateless widget

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

damath, datter, flutter, vector_math

More

Packages that depend on mationani