Created
June 13, 2019 19:16
-
-
Save boriszv/6ddda30b0aaa44ac59725981d120d5e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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