A simple & powerfull pre-built animation kit.
dependencies:
spring: ^2.0.2
import 'package:spring/spring.dart';
Spring.slide(
slideType: SlideType.slide_in_right,
child: FlutterLogo(),
),
import 'package:flutter/material.dart';
import 'package:spring/spring.dart';
import 'package:test123/blue_card.dart';
import 'package:test123/red_card.dart';
class SpringExample extends StatelessWidget {
final SpringController springController =
SpringController(initialAnim: Motion.play);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Spring.slide(
springController: springController,
slideType: SlideType.slide_in_right,
delay: Duration(milliseconds: 500),
animDuration: Duration(milliseconds: 1000),
curve: Curves.easeInExpo,
extend: 30,
withFade: true,
animStatus: (AnimStatus status) {
print(status);
},
child: GestureDetector(
onTap: () {
springController.play(motion: Motion.reverse);
},
child: FlutterLogo()),
),
),
);
}
}
//initial anim = Motion.play
final SpringController springController =
SpringController();
// you can set the initial anim using initialAnim param..
final SpringController springController =
SpringController(initialAnim: Motion.pause,);
GestureDetector(
onTap: () {
springController.play(
motion: Motion.reverse,
animDuration: Duration(milliseconds: 300),
curve: Curves.bounceIn,
delay: Duration(milliseconds: 900));
},
child: Spring.slide(
springController: springController,
slideType: SlideType.slide_in_right,
delay: Duration(milliseconds: 500),
animDuration: Duration(milliseconds: 1000),
curve: Curves.easeInExpo,
extend: 30,
withFade: true,
animStatus: (AnimStatus status) {
print(status);
},
child: FlutterLogo()),
),
You can listen for animation Staus via animStatus callBack which returns AnimStatus enum.
- AnimStatus.forward
- AnimStatus.completed
- AnimStatus.reverse
- AnimStatus.dismissed
Spring.rotate(
springController: springController,
animStatus: (AnimStatus status) {
print(status);
},
child: FlutterLogo()),
If you encounter any problems please open an issue. If you feel the library is missing a feature, please raise a ticket on Github and we'll look into it. Pull request are welcome.
- A special thanks to Felix Blaschke for his simple_animations & supercharged packages. This package literally depends on it.
- Thanks to gskinner.com for universal_platform package.
MIT License