<p>This Flutter example will help you to create a nested ListView with images. In order to try this example, all you need to do is to copy-paste the below code into main.dart file of your freshly created flutter project. The final output of this example is as below, ; background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre-wrap;](color: #569cd6;](import color: #ce9178;]('package:flutter/material.dart'; color: #569cd6;](void color: #dcdcaa;](main() color: #569cd6;](class color: #4ec9b0;](MyApp color: #569cd6;](extends color: #4ec9b0;](StatelessWidget { color: #569cd6;](@override color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext context) { color: #569cd6;](final title = color: #ce9178;]("Nested ListView List"; color: #4ec9b0;](List choices = color: #569cd6;](const [ color: #569cd6;](const color: #4ec9b0;](Choice( title: color: #ce9178;]('MacBook Pro', date: color: #ce9178;]('1 June 2019', description: color: #ce9178;]('MacBook Pro (sometimes abbreviated as MBP) is a line of Macintosh portable computers introduced in January 2006 by Apple Inc.', imglink: color: #ce9178;]('https://images.unsplash.com/photo-1517694712202-14dd9538aa97?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60'), color: #569cd6;](const color: #4ec9b0;](Choice( title: color: #ce9178;]('MacBook Air', date: color: #ce9178;]('1 June 2016', description: color: #ce9178;]('MacBook Air is a line of laptop computers developed and manufactured by Apple Inc. It consists of a full-size keyboard, a machined aluminum case, and a thin light structure.', imglink: color: #ce9178;]('https://images.unsplash.com/photo-1499673610122-01c7122c5dcb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60'), color: #569cd6;](const color: #4ec9b0;](Choice( title: color: #ce9178;]('iMac', date: color: #ce9178;]('1 June 2019', description: color: #ce9178;]('iMac is a family of all-in-one Macintosh desktop computers designed and built by Apple Inc. It has been the primary part of Apple consumer desktop offerings since its debut in August 1998, and has evolved through seven distinct forms.', imglink: color: #ce9178;]('https://images.unsplash.com/photo-1517059224940-d4af9eec41b7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60'), color: #569cd6;](const color: #4ec9b0;](Choice( title: color: #ce9178;]('Mac Mini', date: color: #ce9178;]('1 June 2017', description: color: #ce9178;]('Mac mini (branded with lowercase "mini") is a desktop computer made by Apple Inc. One of four desktop computers in the current Macintosh lineup, along with the iMac, Mac Pro, and iMac Pro, it uses many components usually featured in laptops to achieve its small size.', imglink: color: #ce9178;]('https://www.apple.com/v/mac-mini/f/images/shared/og_image__4mdtjbfhcduu_large.png?201904170831'), color: #569cd6;](const color: #4ec9b0;](Choice( title: color: #ce9178;]('Mac Pro', date: color: #ce9178;]('1 June 2018', description: color: #ce9178;]('Mac Pro is a series of workstation and server computer cases designed, manufactured and sold by Apple Inc. since 2006. The Mac Pro, in most configurations and in terms of speed and performance, is the most powerful computer that Apple offers.', imglink: color: #ce9178;]('https://i0.wp.com/9to5mac.com/wp-content/uploads/sites/6/2017/01/mac-pro-2-concept-image.png?resize=1000%2C500&quality=82&strip=all&ssl=1'), ]; color: #c586c0;](return color: #4ec9b0;](MaterialApp( title: title, home: color: #4ec9b0;](Scaffold( appBar: color: #4ec9b0;](AppBar( title: color: #4ec9b0;](Text(title), ), body: color: #4ec9b0;](ListView( children: [ color: #4ec9b0;](Container( height: color: #b5cea8;](300.0, child: color: #4ec9b0;](ListView( scrollDirection: color: #4ec9b0;](Axis.horizontal, shrinkWrap: color: #569cd6;](true, padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #dcdcaa;](all(color: #b5cea8;](20.0), children: color: #4ec9b0;](List.color: #dcdcaa;](generate(choices.length, (index) { color: #c586c0;](return color: #4ec9b0;](Center( child: color: #4ec9b0;](ChoiceCard( choice: choices[index], item: choices[index]), ); })), ), color: #4ec9b0;](Container( height: color: #b5cea8;](300.0, child: color: #4ec9b0;](ListView( scrollDirection: color: #4ec9b0;](Axis.horizontal, shrinkWrap: color: #569cd6;](true, padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #dcdcaa;](all(color: #b5cea8;](20.0), children: color: #4ec9b0;](List.color: #dcdcaa;](generate(choices.length, (index) { color: #c586c0;](return color: #4ec9b0;](Center( child: color: #4ec9b0;](ChoiceCard( choice: choices[index], item: choices[index]), ); })), ), color: #4ec9b0;](Container( height: color: #b5cea8;](300.0, child: color: #4ec9b0;](ListView( scrollDirection: color: #4ec9b0;](Axis.horizontal, shrinkWrap: color: #569cd6;](true, padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #dcdcaa;](all(color: #b5cea8;](20.0), children: color: #4ec9b0;](List.color: #dcdcaa;](generate(choices.length, (index) { color: #c586c0;](return color: #4ec9b0;](Center( child: color: #4ec9b0;](ChoiceCard( choice: choices[index], item: choices[index]), ); })), ), ]))); }} color: #569cd6;](class color: #4ec9b0;](Choice { color: #569cd6;](final color: #4ec9b0;](String title; color: #569cd6;](final color: #4ec9b0;](String date; color: #569cd6;](final color: #4ec9b0;](String description; color: #569cd6;](final color: #4ec9b0;](String imglink; color: #569cd6;](const color: #4ec9b0;](Choice();} color: #569cd6;](class color: #4ec9b0;](ChoiceCard color: #569cd6;](extends color: #4ec9b0;](StatelessWidget { color: #569cd6;](const color: #4ec9b0;](ChoiceCard( {color: #4ec9b0;](Key key, color: #569cd6;](this.choice, color: #569cd6;](this.onTap, color: #569cd6;](@required color: #569cd6;](this.item, color: #569cd6;](this.selected: color: #569cd6;](false}) : color: #569cd6;](super(key: key); color: #569cd6;](final color: #4ec9b0;](Choice choice; color: #569cd6;](final color: #4ec9b0;](VoidCallback onTap; color: #569cd6;](final color: #4ec9b0;](Choice item; color: #569cd6;](final color: #4ec9b0;](bool selected; color: #569cd6;](@override color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext context) { color: #4ec9b0;](TextStyle textStyle = color: #4ec9b0;](Theme.color: #dcdcaa;](of(context).textTheme.display1; color: #c586c0;](if (selected) textStyle = textStyle.color: #dcdcaa;](copyWith(color: color: #4ec9b0;](Colors.lightGreenAccent<a href="400%5D">color: #b5cea8;</a>; color: #c586c0;](return color: #4ec9b0;](Card( color: color: #4ec9b0;](Colors.white, child: color: #4ec9b0;](Column( children: [ color: #c586c0;](new color: #4ec9b0;](Expanded( child: color: #4ec9b0;](Container( width: color: #b5cea8;](260.0, height: color: #b5cea8;](260.0, child: color: #4ec9b0;](Image.color: #dcdcaa;](network(choice.imglink), )), color: #c586c0;](new color: #4ec9b0;](Container( width: color: #b5cea8;](260.0, padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #dcdcaa;](all(color: #b5cea8;](10.0), child: color: #4ec9b0;](Column( mainAxisAlignment: color: #4ec9b0;](MainAxisAlignment.spaceEvenly, crossAxisAlignment: color: #4ec9b0;](CrossAxisAlignment.start, children: [ color: #4ec9b0;](Text(choice.title, style: color: #4ec9b0;](Theme.color: #dcdcaa;](of(context).textTheme.title), color: #4ec9b0;](Text(choice.date, style: color: #4ec9b0;](TextStyle(color: color: #4ec9b0;](Colors.black.color: #dcdcaa;](withOpacity(color: #b5cea8;](0.5))), color: #4ec9b0;](Text(choice.description), ], ), ) ], crossAxisAlignment: color: #4ec9b0;](CrossAxisAlignment.start, )); }}</p> <p>Hope this helps. Thanks,Srikanth</p>
Nested ListView example in Flutter
This Article is posted by seven.srikanth at 10/20/2019 3:42:47 PM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags: nested listview;
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter