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: []
)
)
);
})
)
)
}
CodePudding user response:
Change Stack to Column. And put in to ListViews physics: NeverScrollableScrollPhysics()
. Then Wrap Column with SingleChildScrollView().
CodePudding user response:
Remove Stack
and use Column
instead.
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
ListView.builder(),
ListView.builder()
]))}