How could i add divider to list? I use flatter for android. I want to add a divider between each line and I want to colorize the divider and add styles.
I tried to
Check out this issue: ListView.builder should let clients specify a divider It makes clear that:
if you need to build your list with dynamic elements, for now you'll have to deal with this issue on your own. I'd recommend in the row widget building, you include a List Divider at the bottom with a column or something, except for the last one (you can test for index == listData.length - 1
).
But if, like in the example you show, you already know all the lists data before hand, or you build it without a ListView.builder
, then you can and should use the named constructor ListView.divideTiles