Home > OS >  Listview showing blank on publish on google playstore but display on debug
Listview showing blank on publish on google playstore but display on debug

Time:07-31

I have a listview with data from my API which work perfectly when I'm debugging the app but when published on the google play store it should as displayed below:

enter image description here

And code is as below and I really don't know what that error is, my code is as below:

ListView.builder(
              shrinkWrap: true,
              physics: const NeverScrollableScrollPhysics(),
              itemCount: _searchResult == null ? 0 : _searchResult.length,
              itemBuilder: (BuildContext context, int index){

                return Card(
                    elevation: 0,
                    semanticContainer: true,
                    child:Container(
                        padding: EdgeInsets.all(5),
                        child:InkWell(
                            onTap: () async {},
                            child:
                        Row(
                            children: <Widget>[
                              Flexible(
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,

                                  children: <Widget>[

                                    InkWell(

                                        onTap:() async {

                                        },
                                        child: Stack(

                                          alignment: Alignment.bottomCenter,

                                          children: [

                                            CircleAvatar(
                                              radius: 20,
                                              backgroundColor: Colors.white,
                                              child: _searchResult[index].profile_img!=null?Container(
                                                  padding: EdgeInsets.all(0),
                                                  child:CircleAvatar(

                                                    radius: 30,
                                                    backgroundImage:NetworkImage(_searchResult[index].profile_img
                                                      ,),
                                                    backgroundColor: Colors.white,
                                                    //
                                                  )):Container(
                                                  padding: EdgeInsets.all(0),
                                                  child:CircleAvatar(

                                                    radius: 30,
                                                    backgroundImage:AssetImage('assets/person_icon.png'),
                                                    backgroundColor: Colors.white,
                                                    //
                                                  )),
                                            ),

                                          ],)),
                    SizedBox(width: 15,),

                    Flexible(
                        //flex: 1,
                        child:   InkWell(
                            onTap: () async {

                            }
                            child:  Align(
                            alignment:Alignment.centerLeft,
                            child:Column(children: [

                        Align(alignment:Alignment.centerLeft,
                            child:Text(_searchResult[index].username==null?_searchResult[index].fullname==null:_searchResult[index].username,style: TextStyle(
                            color: colorBlack,
                            fontWeight: FontWeight.bold,
                            fontSize: 12,
                            fontFamily: 'Montserrat',
                          ),)),
                          SizedBox(height: 5,),
                            Align(alignment:Alignment.centerLeft,
                              child:Text(_searchResult[index].fullname==null?"Hobber":_searchResult[index].fullname,style: TextStyle(
                            color: colorBlack,
                            fontWeight: FontWeight.normal,
                            fontSize: 10,
                            fontFamily: 'Montserrat',
                          ),)),

                    ],)))),


                                    SizedBox(height: 3,),

                              
                                  ],
                                ),
                              ),
                            ]))));

              })

Above is my code and when I run this on android studio it works perfectly but when I published on the google play store it shows as the image attached and I really can't figure out where the issue is but will be glad if anyone can help out with this. Thanks ahead

CodePudding user response:

I was able to resolve this, I checked my Run: Console on Android Studio and saw an error Exception caught by widgets library : Incorrect use of ParentDataWidget. whenever the listview loads and this was as a result of using Expanded and Flexible not a direct child of Column or Row orFlex and after a fixed this then I reuploaded my APK file back on play store and my listview displays fine.

CodePudding user response:

Above view is typical display of component crashing in runtime, in code above everything can be ok, while data before that might not be preprared as expected and then cause crashing in runtime.

Compile app as release, leave debuger on and see what is not comming to builder as expected.

  • Related