Scroll ListView and GridView for scrollable widgets

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.

Example Code

file_type_dartlang main.dart
class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       body: ListView(
         scrollDirection: Axis.horizontal,
         children: _cards(),
       )
     ),
   );
 }

 List<Widget> _cards() {
   return [1,2,3,4,5,6,7,8,9].map((v) => Container(
       color: Colors.blue,
       margin: EdgeInsets.all(20),
       height: 100,
       child: Text('$v'),
     )
   ).toList();
 }

Questions?

Ask questions via GitHub below OR chat on Slack #questions