Not able to nest list in ExpansionTileCard in flutter

140 views Asked by At

I am trying to nest listview.builder in ExpansionTileCard but not able to do so I am getting this error

ERROR

The following assertion was thrown during performResize(): Vertical viewport was given unbounded height.

CODE

ExpansionTileCard(


                leading: GestureDetector(
                  onTap: (){

                    var firstdata = jsonResponse['content'];

                    code = firstdata[index]['code'];
                  },
                  child: ClipRRect(
                      borderRadius: BorderRadius.circular(10),
                      child: Image.asset('images/appicon.png', width: 50, height: 50)),

                ),

                title: GestureDetector(
                    onTap: (){

                      var firstdata = jsonResponse['content'];

                      code = firstdata[index]['code'];
                      name = firstdata[index]['name'];

                      Navigator.push(context, MaterialPageRoute(builder: (context) =>PageViewClass(companycode: code,userid: widget.userid,)));
                    },
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(firstdata[index]['name'] ?? 'NULL PASSED'),
                    
                  ],
                ),

                ),
                children: <Widget>[
                  Divider(
                    thickness: 1.0,
                    height: 1.0,

                  ),
                  Align(
                    alignment: Alignment.center,
                    child: Padding(
                      padding: const EdgeInsets.symmetric(
                        horizontal: 16.0,
                        vertical: 8.0,
                      ),

                  child:ListView.builder(
                      itemCount: list1.length,
                      itemBuilder: (BuildContext ctx, int index){

                       return Text(list1[index]['name']);



                      }
                  )

                    ),
                  ),
                ],
              );

TheExpansionTileCard is already used in a parent Listview.builder .

Please guide me to resolve this issue

1

There are 1 answers

0
Darsh Shah On BEST ANSWER

In Listview.builder you can try to keep shrinkWrap: true, and in Column Widget, you can keep mainAxisSize = MainAxisSize.min,

A combination of this both should do the trick.