Skip to content

Latest commit

 

History

History
66 lines (52 loc) · 1.62 KB

scale.md

File metadata and controls

66 lines (52 loc) · 1.62 KB

Scale

scale

Simple Scale

   Row(children: [
        Spring.scale( //animation lik e zoomOut
            start: 1.0,
            end: 0.2,
            child: RedCard(),
          ),
          Spring.scale( //animation lik e zoomIn
            start: 0.2,
            end: 1.0,
            child: BlueCard(),
          ),
        ],
      )

scale

Customized Scale example

import 'package:flutter/material.dart';
import 'package:spring/spring.dart';
import 'package:test123/red_card.dart';

class SpringExample extends StatelessWidget {
  final SpringController springController = SpringController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Center(
          child: GestureDetector(
            onTap: () {
              //reverse the animation on red card click with changed curve
              springController.play(
                  motion: Motion.reverse, curve: Curves.easeInOut);
            },
            child: Spring.scale(
              springController: springController,
              start: 0.0, //required
              end: 1.0, //required
              animDuration: Duration(milliseconds: 2000), //def=1s,
              animStatus: (AnimStatus status) {
                print(status);
              },
              curve: Curves.bounceOut, //def=Curves.easeInOut
              child: RedCard(),
            ),
          )),
    );
  }
}