Skip to content

Instantly share code, notes, and snippets.

@Rahiche
Created December 13, 2018 19:49
Show Gist options
  • Save Rahiche/a5c6c8b970a0d897f365166d4541eb6f to your computer and use it in GitHub Desktop.
Save Rahiche/a5c6c8b970a0d897f365166d4541eb6f to your computer and use it in GitHub Desktop.
transitionBuilder: (Widget child, Animation<double> animation) {
final inAnimation =
Tween<Offset>(begin: Offset(1.0, 0.0), end: Offset(0.0, 0.0))
.animate(animation);
final outAnimation =
Tween<Offset>(begin: Offset(-1.0, 0.0), end: Offset(0.0, 0.0))
.animate(animation);
if (child.key == ValueKey(elapsed)) {
return ClipRect(
child: SlideTransition(
position: inAnimation,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: child,
),
),
);
} else {
return ClipRect(
child: SlideTransition(
position: outAnimation,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: child,
),
),
);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment