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?✗ Incorrect
The
key property uniquely identifies the Dismissible widget and is required.Which callback is triggered when a
Dismissible widget is swiped away?✗ Incorrect
The
onDismissed callback runs when the widget is dismissed by swiping.What does the
background property in Dismissible do?✗ Incorrect
The
background widget appears behind the child during swipe to give visual feedback.How can you restrict swipe to only left-to-right in
Dismissible?✗ Incorrect
The
direction property controls allowed swipe directions; startToEnd means left-to-right in LTR languages.What happens if you do not provide a unique key to a
Dismissible widget?✗ Incorrect
Flutter requires a unique key for
Dismissible widgets and throws a runtime error if missing.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.