0
0
Fluttermobile~20 mins

Hero animations in Flutter - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Hero Animation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
What happens when two Hero widgets have different tags?
Consider two screens each containing a Hero widget. The Hero on the first screen has tag 'hero1', and the Hero on the second screen has tag 'hero2'. What will happen when navigating between these screens?
AThe app will crash due to tag mismatch.
BThe Hero animation will run smoothly between the two widgets despite different tags.
CThe Hero animation will not run; the widgets will just appear without animation.
DThe Hero widgets will animate but with a flicker effect.
Attempts:
2 left
💡 Hint
Hero animations require matching tags to link widgets across screens.
lifecycle
intermediate
2:00remaining
When does the Hero animation start during navigation?
At what point in the navigation lifecycle does the Hero animation begin when pushing a new route?
AAfter both the source and destination widgets have been built and laid out.
BImmediately after the new route is pushed but before the new screen builds.
CBefore the source widget is removed from the widget tree.
DOnly after the new route's build method completes.
Attempts:
2 left
💡 Hint
Think about when Flutter can measure widget positions for animation.
📝 Syntax
advanced
2:00remaining
Identify the correct Hero widget usage
Which of the following Flutter code snippets correctly implements a Hero widget wrapping an Image with tag 'profilePic'?
AHero(tag: 'profilePic', child: Image.asset('assets/pic.png'))
BHero(child: Image.asset('assets/pic.png'), tag: 'profilePic')
CHero(tag: 'profilePic', child: Image('assets/pic.png'))
DHero(tag: profilePic, child: Image.asset('assets/pic.png'))
Attempts:
2 left
💡 Hint
Check the order of parameters and tag type.
🔧 Debug
advanced
2:00remaining
Why does this Hero animation cause a jump instead of smooth transition?
Given two screens with Hero widgets sharing the same tag, the animation jumps abruptly instead of smoothly transitioning. What is the most likely cause?
Flutter
Screen 1:
Hero(tag: 'logo', child: Container(width: 100, height: 100, color: Colors.blue))

Screen 2:
Hero(tag: 'logo', child: Container(width: 200, height: 200, color: Colors.blue))
AThe Hero widgets have different tags causing the jump.
BThe Hero widgets have different sizes causing the jump.
CThe Hero widgets are missing a Material ancestor.
DThe Hero widgets have different colors causing the jump.
Attempts:
2 left
💡 Hint
Hero animations can handle size changes but abrupt jumps usually mean size difference without smooth scaling.
🧠 Conceptual
expert
2:00remaining
What is the role of FlightShuttleBuilder in Hero animations?
In Flutter's Hero widget, what does the FlightShuttleBuilder property control?
AIt disables the Hero animation when set to null.
BIt controls the duration of the Hero animation.
CIt specifies the curve used for the Hero animation.
DIt defines the widget shown during the Hero's flight animation between screens.
Attempts:
2 left
💡 Hint
Think about customizing the look of the Hero while it moves.