Slide 21
Slide 21 text
void main() {
runApp(MyApp(
items: List.generate(10000, (i) => "Item $i"),
));
}
class MyApp extends StatelessWidget {
final List items;
MyApp({Key key, @required this.items}) : super(key: key);
@override
Widget build(BuildContext context) {
final title = 'Long List';
return MaterialApp(
title: title,
home: Scaffold(
appBar: AppBar(
title: Text(title),
),
body: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
leading: CircleAvatar(child: Icon(Icons.person_outline), backgroundColor: Colors.blue,),
title: Text('${items[index]}'),
);
},
),
),
);
}
}