[FIXED] two listtView are overlapping on same screen

Issue

I have two listView and they are overlapping on same screen.I have tried with singleChildScrollView also.
How to solve this issue and thanks in advance.
The code

    Widget build(BuildContext context) {
        return Scaffold(
          body: Stack(
            children: [
              if(submittedComment.isNotEmpty)...[
                ListView.builder(itemCount: submittedComment.length,shrinkWrap: true, scrollDirection: Axis.vertical, itemBuilder: (context,index){
               return Container(
                    width: MediaQuery.of(context).size.width-150,
                    child: Card(
                      child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children:[]
                          )
                        )
                      )
                   });
              ],
ListView.builder(
            itemCount: widget.snapshot.comments.length,
            scrollDirection: Axis.vertical,
            padding: EdgeInsets.only(bottom: 20),
            itemBuilder: (context, j) {
              return Container(
                width: MediaQuery.of(context).size.width-150,
              
                child: Card(
                  child: Row(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: []
                   )
                 )
                 );
              })

)
)
}

Solution

Change Stack to Column. And put in to ListViews physics: NeverScrollableScrollPhysics(). Then Wrap Column with SingleChildScrollView().

Answered By – Sulaymon Ne'matov

Answer Checked By – Candace Johnson (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published