Huge space between list view and other widgets












1














I have a container contains a column of containers and listviews .. in this way: 1. container 2. listview 3. container 4. listview ... I did it this way:



Container(
color: Colors.white,
child: Stack(
overflow: Overflow.visible,
children: <Widget>[
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: .......
);
},
),
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: .....
);
},
),
),
],
),
],
),
),


i can't remove Expanded from the listview .. if i did the list view will not appear inside the column ..



Also, I tried to use Flexible but the same problem is there ..



this does what i need .. but there's a huge space between the first listview and the second container .. how to remove this empty space and make the listview height wrap depending on the height of the content?










share|improve this question
























  • Have you try to set padding of the ListView to EdgeInsets.zero ?
    – Goon Nguyen
    yesterday










  • @GoonNguyen yes .. and still the same .. there's a space
    – mrs.bassim
    yesterday
















1














I have a container contains a column of containers and listviews .. in this way: 1. container 2. listview 3. container 4. listview ... I did it this way:



Container(
color: Colors.white,
child: Stack(
overflow: Overflow.visible,
children: <Widget>[
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: .......
);
},
),
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: .....
);
},
),
),
],
),
],
),
),


i can't remove Expanded from the listview .. if i did the list view will not appear inside the column ..



Also, I tried to use Flexible but the same problem is there ..



this does what i need .. but there's a huge space between the first listview and the second container .. how to remove this empty space and make the listview height wrap depending on the height of the content?










share|improve this question
























  • Have you try to set padding of the ListView to EdgeInsets.zero ?
    – Goon Nguyen
    yesterday










  • @GoonNguyen yes .. and still the same .. there's a space
    – mrs.bassim
    yesterday














1












1








1







I have a container contains a column of containers and listviews .. in this way: 1. container 2. listview 3. container 4. listview ... I did it this way:



Container(
color: Colors.white,
child: Stack(
overflow: Overflow.visible,
children: <Widget>[
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: .......
);
},
),
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: .....
);
},
),
),
],
),
],
),
),


i can't remove Expanded from the listview .. if i did the list view will not appear inside the column ..



Also, I tried to use Flexible but the same problem is there ..



this does what i need .. but there's a huge space between the first listview and the second container .. how to remove this empty space and make the listview height wrap depending on the height of the content?










share|improve this question















I have a container contains a column of containers and listviews .. in this way: 1. container 2. listview 3. container 4. listview ... I did it this way:



Container(
color: Colors.white,
child: Stack(
overflow: Overflow.visible,
children: <Widget>[
new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: .......
);
},
),
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
Expanded(
child: ListView.builder(
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: .....
);
},
),
),
],
),
],
),
),


i can't remove Expanded from the listview .. if i did the list view will not appear inside the column ..



Also, I tried to use Flexible but the same problem is there ..



this does what i need .. but there's a huge space between the first listview and the second container .. how to remove this empty space and make the listview height wrap depending on the height of the content?







dart flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









Shireesha Parampalli

11012




11012










asked yesterday









mrs.bassim

948




948












  • Have you try to set padding of the ListView to EdgeInsets.zero ?
    – Goon Nguyen
    yesterday










  • @GoonNguyen yes .. and still the same .. there's a space
    – mrs.bassim
    yesterday


















  • Have you try to set padding of the ListView to EdgeInsets.zero ?
    – Goon Nguyen
    yesterday










  • @GoonNguyen yes .. and still the same .. there's a space
    – mrs.bassim
    yesterday
















Have you try to set padding of the ListView to EdgeInsets.zero ?
– Goon Nguyen
yesterday




Have you try to set padding of the ListView to EdgeInsets.zero ?
– Goon Nguyen
yesterday












@GoonNguyen yes .. and still the same .. there's a space
– mrs.bassim
yesterday




@GoonNguyen yes .. and still the same .. there's a space
– mrs.bassim
yesterday












1 Answer
1






active

oldest

votes


















0














Try this code



ListView(
shrinkWrap: true,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
],
),





share|improve this answer










New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • still there's the space i want to remove :(
    – mrs.bassim
    yesterday










  • i have edited the answer please check
    – Epizon
    yesterday










  • yes!! Thank you so much!!
    – mrs.bassim
    yesterday











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53943905%2fhuge-space-between-list-view-and-other-widgets%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try this code



ListView(
shrinkWrap: true,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
],
),





share|improve this answer










New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • still there's the space i want to remove :(
    – mrs.bassim
    yesterday










  • i have edited the answer please check
    – Epizon
    yesterday










  • yes!! Thank you so much!!
    – mrs.bassim
    yesterday
















0














Try this code



ListView(
shrinkWrap: true,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
],
),





share|improve this answer










New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • still there's the space i want to remove :(
    – mrs.bassim
    yesterday










  • i have edited the answer please check
    – Epizon
    yesterday










  • yes!! Thank you so much!!
    – mrs.bassim
    yesterday














0












0








0






Try this code



ListView(
shrinkWrap: true,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
],
),





share|improve this answer










New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









Try this code



ListView(
shrinkWrap: true,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header1",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 20.0, right: 20.0, top: 15.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
Container(
child: Padding(
padding: EdgeInsets.only(
right: 20.0, left: 20.0, top: 5.0, bottom: 5.0),
child: new Text(
"header2",
),
),
color: Color(0xfff8f8f8),
),
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (BuildContext context, int index) {
return new Padding(
padding: EdgeInsets.only(
left: 0.0, right: 0.0, top: 0.0),
child: ListTile(title: Text(titles[index]),)
);
},
),
],
),






share|improve this answer










New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer








edited yesterday





















New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered yesterday









Epizon

645




645




New contributor




Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Epizon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • still there's the space i want to remove :(
    – mrs.bassim
    yesterday










  • i have edited the answer please check
    – Epizon
    yesterday










  • yes!! Thank you so much!!
    – mrs.bassim
    yesterday


















  • still there's the space i want to remove :(
    – mrs.bassim
    yesterday










  • i have edited the answer please check
    – Epizon
    yesterday










  • yes!! Thank you so much!!
    – mrs.bassim
    yesterday
















still there's the space i want to remove :(
– mrs.bassim
yesterday




still there's the space i want to remove :(
– mrs.bassim
yesterday












i have edited the answer please check
– Epizon
yesterday




i have edited the answer please check
– Epizon
yesterday












yes!! Thank you so much!!
– mrs.bassim
yesterday




yes!! Thank you so much!!
– mrs.bassim
yesterday


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53943905%2fhuge-space-between-list-view-and-other-widgets%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas