Erlend
Erlend

Reputation: 1969

Recreate crossDissolve navigation in Flutter

How can i recreate the modalTransitionStyle = .crossDissolve from iOS when navigating between two pages in Flutter using a Route.

Upvotes: 1

Views: 115

Answers (1)

diegoveloper
diegoveloper

Reputation: 103351

Here you have, you can change the transitionDuration :

              Navigator.of(context).push(
        PageRouteBuilder<Null>(
            pageBuilder: (BuildContext context, Animation<double> animation,
                Animation<double> secondaryAnimation) {
              return AnimatedBuilder(
                  animation: animation,
                  builder: (BuildContext context, Widget child) {
                    return Opacity(
                      opacity: animation.value,
                      child: YourWidgetPage(),
                    );
                  });
            },
            transitionDuration: Duration(milliseconds: 600)),
      );

Upvotes: 2

Related Questions