Skip to content

Commit

Permalink
feat: allow changing transition duration (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 authored Apr 11, 2024
1 parent 064b2f0 commit a12b4cc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions lib/src/screen_transitions/nes_fill.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ class NesFillTransition extends NesOverlayTransitionWidget {
/// Creates a route with this animation.
static PageRouteBuilder<T> route<T>({
required RoutePageBuilder pageBuilder,
Duration duration = const Duration(milliseconds: 750),
}) {
return PageRouteBuilder<T>(
pageBuilder: pageBuilder,
reverseTransitionDuration: const Duration(milliseconds: 750),
transitionDuration: const Duration(milliseconds: 750),
reverseTransitionDuration: duration,
transitionDuration: duration,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return NesFillTransition(
animation: animation,
Expand Down
5 changes: 3 additions & 2 deletions lib/src/screen_transitions/nes_horizontal_close.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class NesHorizontalCloseTransition extends NesOverlayTransitionWidget {
/// Creates a route with this animation.
static PageRouteBuilder<T> route<T>({
required RoutePageBuilder pageBuilder,
Duration duration = const Duration(milliseconds: 750),
}) {
return PageRouteBuilder<T>(
pageBuilder: pageBuilder,
reverseTransitionDuration: const Duration(milliseconds: 750),
transitionDuration: const Duration(milliseconds: 750),
reverseTransitionDuration: duration,
transitionDuration: duration,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return NesHorizontalCloseTransition(
animation: animation,
Expand Down
5 changes: 3 additions & 2 deletions lib/src/screen_transitions/nes_horizontal_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class NesHorizontalGridTransition extends NesOverlayTransitionWidget {
/// Creates a route with this animation.
static PageRouteBuilder<T> route<T>({
required RoutePageBuilder pageBuilder,
Duration duration = const Duration(milliseconds: 1750),
}) {
return PageRouteBuilder<T>(
pageBuilder: pageBuilder,
reverseTransitionDuration: const Duration(milliseconds: 1750),
transitionDuration: const Duration(milliseconds: 1750),
reverseTransitionDuration: duration,
transitionDuration: duration,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return NesHorizontalGridTransition(
animation: animation,
Expand Down
5 changes: 3 additions & 2 deletions lib/src/screen_transitions/nes_vertical_close.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class NesVerticalCloseTransition extends NesOverlayTransitionWidget {
/// Creates a route with this animation.
static PageRouteBuilder<T> route<T>({
required RoutePageBuilder pageBuilder,
Duration duration = const Duration(milliseconds: 750),
}) {
return PageRouteBuilder<T>(
pageBuilder: pageBuilder,
reverseTransitionDuration: const Duration(milliseconds: 750),
transitionDuration: const Duration(milliseconds: 750),
reverseTransitionDuration: duration,
transitionDuration: duration,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return NesVerticalCloseTransition(
animation: animation,
Expand Down
5 changes: 3 additions & 2 deletions lib/src/screen_transitions/nes_vertical_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class NesVerticalGridTransition extends NesOverlayTransitionWidget {
/// Creates a route with this animation.
static PageRouteBuilder<T> route<T>({
required RoutePageBuilder pageBuilder,
Duration duration = const Duration(milliseconds: 1750),
}) {
return PageRouteBuilder<T>(
pageBuilder: pageBuilder,
reverseTransitionDuration: const Duration(milliseconds: 1750),
transitionDuration: const Duration(milliseconds: 1750),
reverseTransitionDuration: duration,
transitionDuration: duration,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return NesVerticalGridTransition(
animation: animation,
Expand Down

0 comments on commit a12b4cc

Please sign in to comment.