Challenge
For this intermediate challenge, create this 3D pushable button:
Open preview in a separate page
Starter Project
You can grab the starter project for this challenge here:
c005_pushable_button_starter.zip
v0.1.0, updated: 2024-02-28
Check the README for how to use it.
Primary Goals
Create a 3D pushable button:
- Replace the
ElevatedButtoninside thePushableButtonclass with a custom UI layout - Use
GestureDetectorto handle taps and drag events - When the button is pressed, trigger the
onPressedcallback so the parent widget can update - Add some animation code to update the button UI when pressed
Stretch Goals
- Ensure the button behaves correctly and does not get stuck when various combinations of gestures are applied
- If a
shadowargument is given, ensure it is applied to the button
What You Will Learn
- How to work with
StackandPositionedwidgets - How to apply custom decorations to
Containerwidgets - How to work with HSL colors
- How to combine
GestureDetector,AnimationController, andAnimatedBuiderto create a custom animated UI button - How to create a reusable button component
Useful Links and Resources
Official resources from Flutter.dev:
Additional resources from Code with Andrea: