heyr
heyr

Reputation: 5794

Flutter: onDismissed

I was wondering if there is a chance to implement on Flutter a function similar to onDismissed that by sliding to the left will trigger a function, and to the right something else? As so far all I could find by doing some research, is to remove items from the list, but nothing more than trigger more than one function. Thank you in advance!

Upvotes: 0

Views: 2833

Answers (1)

Vinoth Kumar
Vinoth Kumar

Reputation: 13451

You can make use of the Dismissible Widget.

Dismissible calls onDismissed when you swipe in the specified direction.

Dismissible(
  direction: DismissDirection.horizontal,
  child: child, // all your content that will be swiped away 
  onDismissed: (direction) {
    if(direction == DismissDirection.endToStart) {
      // dismissed to the left
    }
  },
);

Upvotes: 3

Related Questions