grouped_list
grouped_list copied to clipboard
grouped_list gr
Hi IM working in Flutter project, basically I query db, convert result in map, fill list with result and pass to groupView.. Everything working but, in every other group first item switch place with some other item from same group at hotrestart app or when setstate is called. If I use dummy data from example here no switching occur? Dose anyone now what cud be wrong?
_groupView() {
return Container(
child: GroupedListView<dynamic, String>(
shrinkWrap: true,
elements: questionsBooks,
groupBy: (element) => element['Category'],
separator: Divider(),
groupComparator: (value1, value2) {
return value1.compareTo(value2);
},
groupSeparatorBuilder: (value) {
return Text(
value.toString(),
);
},
indexedItemBuilder: (context, element, index) {
return CheckboxListTile(
value: true,
contentPadding: EdgeInsets.symmetric(horizontal: 8.0),
title: Text(
element['Description'],
),
onChanged: (bool? value) {
}
},
);
},
),
);
}
Future<void> _getData() async {
List<Map<String, dynamic>> result = await dbService.getRelatedTo();
if (result.isNotEmpty) {
var map = new Map<String, dynamic>();
for (int i = 0; i < result.length; i++) {
map['Description'] = result[i]['Description'].toString();
map['Category'] = result[i]['Category'].toString();
questionsBooks.add(Map<dynamic, String>.from(map));
}
}
}
GetData is caled in initState, so every time i hot reload app or rebuild, grouping item first in second group is changed to some other if reload again all get back to normal? Strange, i cud need any help ty.
I was able to reproduce bug, it seams that error is only if list is longer than 32...
Closing this in favor of #167