Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Updated 5 January 2024
You can wrap a widget as a child of Dismissible in Flutter if you need to construct a dismissible widget. Rejectable Typically, a widget in Flutter is used to wrap each list item, either vertically or horizontally, allowing it to be dismissed. I’ll walk you through a few instances of using the widget, such as displaying the confirmation dialog, customizing the backdrop that appears when the child is dismissed, and defining the dismiss direction.
You can also check out our Flutter app development services for more Flutter app development.
A widget that can be dismissed by dragging in the indicated direction. Dragging or flinging this widget in the DismissDirection causes the child to slide out of view.
Here’s the list of properties Dismissible you can pass to the constructor.
Dismissible
Key key
Widget child
Widget background
secondaryBackground
Widget secondaryBackground
ConfirmDismissCallback confirmDismiss
VoidCallback onResize
DismissDirectionCallback onDismissed
DismissDirection direction
DismissDirection.horizontal
Duration resizeDuration
onDismissed
const Duration(milliseconds: 300)
Map<DismissDirection, double> dismissThresholds
const <DismissDirection, double>
Duration movementDuration
const Duration(milliseconds: 200)
double crossAxisEndOffset
0.0
DragStartBehavior dragStartBehavior
DragStartBehavior.start
Both the child (Widget) and the key (Key) must be supplied. The key becomes essential since the widget may be removed from the widget list. If there are multiple dismissible widgets, make sure each one has a unique key. Since dismissing one widget may change the index of other widgets, avoid using the index as a key. child is the second required property, and passing a dismissible widget is required.
The onDismissed property is another crucial one. It’s a callback function that takes one DismissDirection parameter.
We’re going to use this data
ListView
The Dismissible is the output of the itemBuilder, which constructs the list items. Apart from the mandatory parameters (key and child), the onDismissed callback is additionally given. You can see how to specify various actions for each direction by looking at the example below.
Final Code
That’s all for this Article.
We learned about the Dismissible Widget in Flutter in this blog.
Visit the link for additional information on the Dismissible Widget in Flutter.
Thanks for reading this blog. You can also check other blogs from here for more knowledge.
View More
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.