Skip to content

Instantly share code, notes, and snippets.

@boriszv
Created June 13, 2019 19:16
Show Gist options
  • Save boriszv/6ddda30b0aaa44ac59725981d120d5e9 to your computer and use it in GitHub Desktop.
Save boriszv/6ddda30b0aaa44ac59725981d120d5e9 to your computer and use it in GitHub Desktop.
class ListViewSeparated extends StatelessWidget {
final List<String> data = [];
ListViewSeparated() {
for (var i = 0; i < 100; i++) {
data.add(_randomString(20));
}
}
@override
Widget build(BuildContext context) {
return ListView.separated(
separatorBuilder: (context, index) => Divider(color: Colors.black,),
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
height: 50,
color: Colors.blue,
child: Center(
child: Text(
data[index],
style: TextStyle(color: Colors.white),
),
),
),
);
},
itemCount: data.length,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment