I'm trying to make a selectable listview.
I chose RadioListTile
,but it doesn't need to be with Radios
,I would be happy with the background color changing of a ListTile
on tapping the item.
So in my current code I have RadioListTiles
,but it doesn't checks on tap,and I think it would let to check more than one,because its in a ListView.builder
,but I don't know since I'm new to flutter,and it's not working.
Here is the code:
ListView.builder(
scrollDirection: Axis.vertical,
itemCount: items.length,
itemBuilder: (context, index) {
return RadioListTile<LoadList>(
selected: isSelected,
groupValue: radiolist,
value: items[index],
onChanged: (LoadList value) {
radiolist.GetHours(value.hours);
print("CurrentSelected $index");
setState(() {
isSelected = true;
});
},
title: new Text(index),
);
},
),