0

I have a flutter app which has a ExpandablePanel as the code shows:

ListView(
          children: [
            ...items.map<Widget>(
                  (item) {
                return ExpandableTheme(
                  data: ExpandableThemeData(
                      hasIcon: false
                  ),
                  child: ExpandablePanel(
                    header: Card(
                      // my code
                    ),
                    expanded: Container(
                      height: MediaQuery.of(context).size.height,
                      width: MediaQuery.of(context).size.width,
                      child: ClassWhichReturnsAContainer(item),
                    ),
                  ),

                );
              },
            )
          ],
        )

Running this it shows my items as expected but the problem is with expand section because when the screen is built it loads the ClassWhichReturnsAContainer for all the items (making a list with all the returns together). I don't want this result, I want not run anything inside expanded until I tap in some item, only when I tap in an item it begins to load and show the content inside ClassWhichReturnsAContainer . How can I do this?

0 Answers0