0
0
Fluttermobile~5 mins

Dismissible for swipe actions in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the Dismissible widget in Flutter?
The Dismissible widget allows users to swipe a widget (usually a list item) to dismiss it, triggering an action like deleting or archiving.
Click to reveal answer
beginner
Which property of Dismissible uniquely identifies the widget?
The key property is required and must be unique to identify the Dismissible widget in the widget tree.
Click to reveal answer
beginner
How do you detect when a Dismissible widget has been swiped away?
Use the onDismissed callback, which is called when the widget is swiped and dismissed. It provides the swipe direction.
Click to reveal answer
intermediate
What is the role of the background property in Dismissible?
The background property defines a widget shown behind the child when swiping, often used to show a delete icon or color to indicate the swipe action.
Click to reveal answer
intermediate
Can you customize swipe directions in Dismissible? How?
Yes, by setting the direction property to values like DismissDirection.startToEnd or DismissDirection.horizontal to control allowed swipe directions.
Click to reveal answer
What must you always provide to a Dismissible widget?
AA unique key
BAn onTap callback
CA background color
DAn icon
Which callback is triggered when a Dismissible widget is swiped away?
AonDismissed
BonTap
ConSwipe
DonDragEnd
What does the background property in Dismissible do?
AHandles the swipe animation
BSets the widget's background color permanently
CDefines the swipe direction
DShows a widget behind the child when swiping
How can you restrict swipe to only left-to-right in Dismissible?
AUse <code>onSwipeLeft</code> callback
BSet <code>direction</code> to <code>DismissDirection.startToEnd</code>
CSet <code>direction</code> to <code>DismissDirection.endToStart</code>
DUse <code>swipeDirection</code> property
What happens if you do not provide a unique key to a Dismissible widget?
AThe app crashes immediately
BThe widget will be dismissed twice
CFlutter throws an error at runtime
DThe widget cannot be swiped
Explain how to implement a swipe-to-delete list item using the Dismissible widget in Flutter.
Think about what each property does and how they work together to detect and respond to swipe.
You got /5 concepts.
    Describe the user experience improvements that the background property adds to swipe actions.
    Consider what the user sees behind the item as they swipe.
    You got /4 concepts.