Skip to content

Instantly share code, notes, and snippets.

@maffan91
Last active March 31, 2019 04:15
Show Gist options
  • Save maffan91/34dcfc67bd7a380624b9ea9fd848828a to your computer and use it in GitHub Desktop.
Save maffan91/34dcfc67bd7a380624b9ea9fd848828a to your computer and use it in GitHub Desktop.
ListView.builder(
itemCount: movies.length,
itemBuilder: (BuildContext context, int index) {
return Dismissible(
onDismissed: (DismissDirection direction) {
if (direction == DismissDirection.endToStart) {
setState(() {
movies.removeAt(index);
});
}
},
secondaryBackground: Container(
child: Center(
child: Text(
'Delete',
style: TextStyle(color: Colors.white),
),
),
color: Colors.red,
),
background: Container(),
child: MovieCard(movie: movies[index]),
key: UniqueKey(),
);
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment