transition 2.0.2 copy "transition: ^2.0.2" to clipboard
transition: ^2.0.2 copied to clipboard

A transition library that helps implement the page transition animation.

transition #

A transition library that helps implement the page transition animation. 💫

pub


Showcase #


Getting Started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  transition : "^lastest_version"

Usage #

Need to include the import the package to the dart file where it will be used, refer the below command

import 'package:transition/transition.dart';

Complete example #

import 'package:flutter/material.dart';
import 'package:transition/transition.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text("Route Transition Example"),
      ),
      body: Container(
        width: double.infinity,
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          transitionButton(
              transitionEffect: TransitionEffect.RIGHT_TO_LEFT,
              title: "RightToLeft"),
          transitionButton(
              transitionEffect: TransitionEffect.LEFT_TO_RIGHT,
              title: "LeftToRight"),
          transitionButton(
              transitionEffect: TransitionEffect.BOTTOM_TO_TOP,
              title: "BottomToTop"),
          transitionButton(
              transitionEffect: TransitionEffect.TOP_TO_BOTTOM,
              title: "TopToBottom"),
          transitionButton(
              transitionEffect: TransitionEffect.SCALE, title: "Scale"),
          transitionButton(
              transitionEffect: TransitionEffect.FADE, title: "Fade"),
        ]),
      ),
    );
  }

  Widget transitionButton(
      {required TransitionEffect transitionEffect, required String title}) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: GestureDetector(
        onTap: () {
          Navigator.push(
              context,
              Transition(
                  child: SecondScreen(), transitionEffect: transitionEffect));
        },
        child: Container(
            height: 40.0,
            width: 100.0,
            color: Colors.grey[300],
            alignment: Alignment.center,
            child: Text(title)),
      ),
    );
  }
}

class SecondScreen extends StatefulWidget {
  @override
  _SecondScreenState createState() => _SecondScreenState();
}

class _SecondScreenState extends State<SecondScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text("Route Transition Example"),
      ),
      body: Container(
        alignment: Alignment.center,
        child: RaisedButton(
          onPressed: () {
            Navigator.pop(context);
          },
          child: Text("Pop"),
        ),
      ),
    );
  }
}



License #

Copyright 2020, the Flutter project authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of Google Inc. nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
likes
150
pub points
84%
popularity

Publisher

unverified uploader

A transition library that helps implement the page transition animation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on transition