Skip to content

Instantly share code, notes, and snippets.

@nitishk72
Created December 12, 2018 06:34
Show Gist options
  • Save nitishk72/0150f80432006591ffa9d82b7ed9b54f to your computer and use it in GitHub Desktop.
Save nitishk72/0150f80432006591ffa9d82b7ed9b54f to your computer and use it in GitHub Desktop.

Revisions

  1. nitishk72 created this gist Dec 12, 2018.
    47 changes: 47 additions & 0 deletions Flutter-Transiton-4.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    import 'package:flutter/material.dart';

    // Usage
    // Navigator.push(context,AppScaleRoute(widget: DetailScreen(),),);
    class AppScaleRoute extends PageRouteBuilder {
    final Widget widget;
    AppScaleRoute({this.widget})
    : super(pageBuilder: (BuildContext context, Animation<double> animation,
    Animation<double> secondaryAnimation) {
    return widget;
    }, transitionsBuilder: (BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
    Widget child) {
    return new ScaleTransition(
    scale: new Tween<double>(
    begin: 0.0,
    end: 1.0,
    ).animate(
    CurvedAnimation(
    parent: animation,
    curve: Interval(
    0.00,
    0.50,
    curve: Curves.linear,
    ),
    ),
    ),
    child: ScaleTransition(
    scale: Tween<double>(
    begin: 1.5,
    end: 1.0,
    ).animate(
    CurvedAnimation(
    parent: animation,
    curve: Interval(
    0.50,
    1.00,
    curve: Curves.linear,
    ),
    ),
    ),
    child: child,
    ),
    );
    });
    }