Amid the COVID-19 outbreak, Folio3 aims to help clinics serve patients with telemedicine effectively.

How to make a Dismissible List View in Flutter

How to make a Dismissible List View in Flutter

In this blog, we’ll look at how we can build a dismissable list view in Flutter. You can think of dismissible widget as a draggable piece UI of that can be dragged in any direction and the action causes the UI to slide out from the view. Here is an example of how it looks and what we are going to build:

The complete code for this project is available on the GitHub repo here. Feel free to fork & use it.

Now, Let’s start building that together.

Create a Flutter Project

First things first, create a Flutter project:

Build Movie Model

In the lib directory of your project, create a new folder with the name modelsadd a new file movie.dart with the following code:

Generate Movie Data

Now we’ll create some static movie data to create our ListView. Obviously, this kind of data might come from an API most of the time. Here just for simplicity, I created an array of movies using hard-coded data (which is real and taken from IMBD).

Create new folder, data in the lib directory of your project. Now add a file with the name movie-list.dart and write the following code:

Important: Your package name can differ from mine based on the name of the project you decided.

We now have a source of data. All we need to do is to build our list. For this, we’ll start with the movie card first.

Build MovieCard UI

Create widgets folder in the lib directory and add file movie-card.dart with the following code:

Note: Although we are not fetching data from anywhere outside the app, however, the images are being fetched through URL for which we are using NetworkImage API of Flutter which loads the image asynchronously.

Build MovieList Page

Now create one more folder pages in the lib directory. Create new file movies.dart and paste the following code:

Take a closer look at the ListView.builder code we used above:

First, we are providing the itemCount with the length of the movies array. Next, the itemBuilder builds and returns the dismissible list item by receiving the context and the index of the item to be built.

The Dismissible Widget

In the itemBuilder method, we are using Flutter’s Dismissible widget. It receives a method under onDismissed along with the DismissDirectionSupported DismissDirections are:

  • endToStart( from right to left)
  • startToEnd (from left to right)
  • horizontal (both from right to left and left to right)
  • up
  • down
  • vertical (both up and down)

In our case, we are only using one direction which is from right to left (endToStart in the code). We are removing that item from the list and performing this action inside the setState() method. Removing the item from the movies list changes the state, so we have to perform this action inside the setState() method. This method under the hood calls the build method to reflect the changes on the UI.

The child receives the actual MovieCard with the movie item to build. Also, a unique key is assigned to the dismissible to avoid duplicates.

We have done almost everything. All we need to do is to call this movies page as soon as the application starts. For this, edit your main.dart file to look like this:

We are all set to launch the app and see how it looks. Run this app on your emulator or any real device to see how it looks.


Using a dismissible widget is very simple and straightforward. You can dismiss it in any direction(horizontal or vertical) and attach events to perform any operations against the event. You can wrap any widget inside Dismissible widget that you can logically think off. Here’s the link to the Flutter’s documentation for Dismissible Widget.

I’ll come with some more exciting stuff on Flutter soon. Till then, Enjoy development with Flutter 🙂


USA408 365 4638


1301 Shoreway Road, Suite 160,

Belmont, CA 94002

Latest From Our Blog

Why the Daily Scrum is NOT a Status Meeting?

February 3, 2020
I am here today to debunk, The Myth “The Daily Scrum is the Status Meeting”. This is a key misconception in the industry and often resu...
Read more

A Complete Guide to Custom Caching in Magento 2...

November 29, 2019
In this blog, I will explain how to create your own cache in Magento 2, and how to read and write data from that custom cache. I hope after reading...
Read more

React Hooks

September 3, 2019
React is a javascript framework for building interactive client side interfaces along with the integration with back-end server. React considers th...
Read more