Example of Creating Expandable ListView in Flutter Android iOS

As we all know at present time most of technology is mobile based. Mobiles are growing so fast between humans as they are part of their life. Today everything is based on mobile like purchasing, selling etc. People can sell their products online, also buy new products online using e-commerce websites. At the time of vising E-Commerce mobile application we have seen so much different type of products on their application and All the products are managed very beautifully using Expandable ListView. Expandable ListView is a type of list view which is used to show multiple type of data based on category and sub category wise. In flutter we can easily make our own Expandable ListView using their ExpansionTile widget. In today’s tutorial we would learn about Example of Creating Expandable ListView in Flutter Android iOS application. So let’s get started 🙂 .

Contents in this project Example of Creating Expandable ListView in Flutter Android iOS:

1. Open your flutter project’s main.dart file and import material.dart package.

2. Creating void main runApp() method and here we would call our main MyApp class.

3. Now we would make a final type of List in our file named as data. The List is type of DataList class which we would create in next 4th step. In this List we would define our all Data which we would display in our expandable ListView.

4. Creating another class named as DataList. Using this class we would print all the items of List in Parent Children format.

5. Creating our main MyApp extends StatelessWidget class. In this class we would make the ListView.builder() and using the DataPopUp class starts printing items on screen.

6. Creating another class named as DataPopUp extends StatelessWidget . In this class we would make a custom widget named as _buildTiles(). Now using the ExpansionTile expandalble ListView widget we would print the items using DataList.

7. Complete source code for main.dart file:

Screenshots:-

Example of Creating Expandable ListView in Flutter Android iOS Example of Creating Expandable ListView in Flutter Android iOS

3 Comments

  1. Hey good work. What if I want to expand list to gridview. How should I go about it?

Leave a Reply

Your email address will not be published. Required fields are marked *