grouped_list icon indicating copy to clipboard operation
grouped_list copied to clipboard

grouped_list gr

Open KlubAndroid opened this issue 3 years ago • 1 comments

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.

KlubAndroid avatar Aug 27 '21 14:08 KlubAndroid

I was able to reproduce bug, it seams that error is only if list is longer than 32...

KlubAndroid avatar Aug 27 '21 16:08 KlubAndroid

Closing this in favor of #167

Dimibe avatar Nov 15 '23 13:11 Dimibe