class HomeWidget2 extends StatelessWidget {
const HomeWidget2({Key? key}) : super(key: key);
static const List<String> people = ["Heimin", "Nannal", "TibFox", "CamStubs", "Brish", "Sagar"];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('New Videos from D.Tube'),
),
body: ListView.separated(
itemBuilder: (context, index) {
return ListTile(
title: Text(people[index]),
leading: Image.asset('images/dtube_logo.png'),
);
},
separatorBuilder: (context, index) {
return const Divider();
},
itemCount: people.length),
);
}
}
With above code snippet, one can easily generate a list-view.
If you want to understand everything step by step, make sure to check out this article - @sagarkothari88/let-s-build-dtube-mobile-app-video-series-005-dynamic-listview-with-images