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.


*Enrollment provides full access to this course (and updates) for life.

Or Signup for Unlimited PRO Access

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();
 }

Q&A Chat