I have a ListView.builder
generating ListTile
s from a List. I would like to achieve an alternating color like you would a typical list.
Is there a Flutter official way to do this? Or I'm stuck with doing something like
ListView.builder(
...
itemBuilder: (...) {
return ListTile
..
title: Container(
decoration: BoxDecoration(color: Colors.grey),
child: Column(children: <Widget>[
Text("What should've been the title property"),
Text("and its trailing"),
],),
),
or something to that effect?
index
passed toitemBuilder
- just use it – Invariant