spring 2.0.0 copy "spring: ^2.0.0" to clipboard
spring: ^2.0.0 copied to clipboard

outdated

A simple & powerfull pre-built animation kit for faster and easy apps developement.

Spring Logo

A simple & powerfull pre-built animation kit.

🔨 Installation #

dependencies:
     spring: ^2.0.0

simple_fade

đŸŽĨ Spring Animations #

⚙ Import #

import 'package:spring/spring.dart';

🕹ī¸ Usage #

Spring.slide(
     slideType: SlideType.slide_in_right,
     child: FlutterLogo(),
),

🕹ī¸ Advanced Usage #

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()),
        ),
      ),
    );
  }
}

🎮 SpringController #

SpringController allow you to control the animations without setting the setState.

//cinitial anim = Motion.play
final SpringController springController =
     SpringController(); 
//
final SpringController springController =
      SpringController(initialAnim: Motion.pause,);

Controlling the animations #

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()),
        ),

🔈 Animation Status #

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()),

🐞 Bugs/Requests #

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.

🙏 Thanks #

📃 License #

MIT License

246
likes
0
pub points
90%
popularity

Publisher

unverified uploader

A simple & powerfull pre-built animation kit for faster and easy apps developement.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, simple_animations, supercharged, universal_platform, vector_math

More

Packages that depend on spring