How to change ListView.builder background image based on certain condition in flutter?
I need to change background image with '${_TempData[i][2]}' condition
body: new ListView.builder(
itemCount: _TempData.length,
itemBuilder: (context, i) => new Column(
children: <Widget>[
new Divider(
height: 10.0,
),
new ListTile(
leading: new CircleAvatar(
backgroundImage: AssetImage('assets/dollar.png'),
AssetImage loadImage(int condition) {Then use it in backgroundImage propertie:
if (condition == 1) return AssetImage('assets/dollar.png');
if (condition == 2) return AssetImage('assets/euro.png');
if (condition == 4) return AssetImage('assets/blabla.png');
}
new ListTile(
leading: new CircleAvatar(
backgroundImage: loadImage(${_TempData[i][2]}),
thanks @Joost, my problem is that _TempData[i][2] == has 4 condition. if use than load use image, if euro than load euro image, if birth pond than load sterling image
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.