0

I am using ExpansionPanelRadio() to make an list of expandable items. Each item, when expanded, contains another list of let's say 'features'. Now, when I have only one expandable element, its list of features looks fine. As soon as I add two or more items, their expanded lists of features grows somehow. (they repeat themselves). And, as more times, as I am clicking (opening) expansion panels, the lists of items grow more and more. Does anybody have an Idea whats going on? Both of the lists (expansion tiles and their expanded bodies must be scrollable).

My 'simplified' code looks like:

SingleChildScrollView(
        child: ExpansionPanelList.radio(
        elevation: 0,
        children: MyList.map<ExpansionPanelRadio>((Item item) {
          return ExpansionPanelRadio(
              value: MyList.indexOf(item),
              headerBuilder: (BuildContext context, bool isExpanded) {
                return Row(
                  children: [
                    Padding(
                      padding: const EdgeInsets.all(10),
                      child: SvgPicture.asset(
                        "assets/images/some_image.svg"
                      ),
                    ),
                    Text('some label'),
                  ],
                );
              },
              body: ChangeNotifierProvider(
                  create: (context) => FeaturesProvider(),
                  builder: (context, child) {
                    Provider.of<FeaturesProvider>(context, listen: false)
                        .readFeatures();

                    return SingleChildScrollView(
                      child: Container(
                        child: Features(item.objectId.toString()),
                      ),
                    );
                  }));
        }).toList(),
      ))
No Ziffer
  • 45
  • 4
  • Could it be that Provider in body is making a problem here? Anyways, I need a Provider here since items in Expanded part are sliders. – No Ziffer Jan 31 '23 at 21:27

0 Answers0