Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.19 KB

flip.md

File metadata and controls

52 lines (40 loc) · 1.19 KB

Flip

flip

Simple Flip

Spring.flip(
    frontWidget: RedCard(),
    rearWidget: BlueCard(),
),

Customized Flip example

iimport '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();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Center(
        child: Spring.flip(
          springController: springController,
          frontWidget: RedCard(), //required
          rearWidget: BlueCard(), //required
          flipAxis: Axis.vertical, //def=Axis.horizantal
          onTap: (side) {
            //only Motion.play and anim Duration are accepted here.
            springController.play();
            print(side); //front or rear
          },
          //you can disable flip on click
          toggleOnClick: false, //def=true
          animDuration: Duration(seconds: 2), //def=1s
        ),
      ),
    );
  }
}