Displaying lists with ListView and GridView
- Objectives
- Code along
- Boilerplate
- Displaying items in a ListView
- Displaying items in a GridView
- The Card widget
- Completed Code
- Other Resources
Objectives
- To learn how to display lists using a ListView or GridView
- To introduce the ListTile and Card widgets for displaying information
Code along
Recording: https://youtu.be/rccHVJdd1Sc
Boilerplate
Troubleshooting: If you already downloaded the project, replace lib/bob_data.dart
with this file bob_data.dart if you’re having trouble.
- Download and unzip lists_and_grids.zip. It will create a folder called
lists_and_grids
. Move this folder to be with your other Flutter projects. - In VSCode, go to File -> Open Folder and select the
lists_and_grids/
folder. - You will see a pop-up in the bottom right about missing or out of data packages. Click the “Get packages” button to download a 3rd-party library used by this app. Or open the Command Palette and search for
flutter pub get
- Open
lib/main.dart
and run the app. You should see the following:
Displaying items in a ListView
ListView More coming soon.
the ListTile widget
ListTile More coming soon.
Displaying items in a GridView
GridView More coming soon.
The Card widget
Card More coming soon.
Completed Code
You can download the completed code here: lists_and_grids.zip