Challenge - 5 Problems
Page Transition Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
Which transition animation will slide the new page from the bottom?
Given the Flutter code below, which option correctly creates a page transition that slides the new page from the bottom of the screen?
Flutter
Navigator.of(context).push(PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => NewPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
// Choose the correct Tween here
final tween = ???;
final offsetAnimation = animation.drive(tween);
return SlideTransition(position: offsetAnimation, child: child);
},
));Attempts:
2 left
💡 Hint
Think about the Offset coordinates: (0, 1) means below the screen, (0, -1) means above.
✗ Incorrect
Offset(0, 1) means the widget starts just below the screen and slides up to its normal position (Offset.zero). This creates a slide-from-bottom animation.
❓ lifecycle
intermediate1:30remaining
When does the transition animation start in Flutter's PageRouteBuilder?
In Flutter, using PageRouteBuilder for custom page transitions, when does the transition animation begin?
Attempts:
2 left
💡 Hint
Think about when Navigator.push triggers the route change.
✗ Incorrect
The animation starts immediately after Navigator.push is called, as the new route begins its transition onto the screen.
📝 Syntax
advanced1:30remaining
Identify the syntax error in this custom fade transition code
What is the syntax error in this Flutter PageRouteBuilder transitionsBuilder snippet?
Flutter
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(
opacity: animation,
child: child,
);
},Attempts:
2 left
💡 Hint
Check the types expected by FadeTransition's opacity parameter.
✗ Incorrect
FadeTransition's opacity parameter accepts an Animation, and animation is already Animation. The code is syntactically correct.
🔧 Debug
advanced2:00remaining
Why does the page not animate when using MaterialPageRoute?
A developer uses Navigator.push with MaterialPageRoute but sees no animation on page transition. What is the most likely cause?
Attempts:
2 left
💡 Hint
MaterialPageRoute uses platform default animations.
✗ Incorrect
MaterialPageRoute uses the platform's default animation, which can be subtle or disabled depending on device settings. It does not require a transitionsBuilder.
🧠 Conceptual
expert2:30remaining
What is the effect of reversing the animation in a PageRouteBuilder transition?
In Flutter, if you reverse the animation parameter in the transitionsBuilder (e.g., using animation.drive(Tween).reverse()), what is the visual effect on the page transition?
Attempts:
2 left
💡 Hint
Think about what reversing a Tween animation does to the movement direction.
✗ Incorrect
Reversing the animation plays the transition backward, so the page appears to come from the opposite direction or the animation runs in reverse.