Huge space between list view and other widgets
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
add a comment |
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
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
add a comment |
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
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
dart flutter
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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]),)
);
},
),
],
),
New contributor
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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]),)
);
},
),
],
),
New contributor
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
add a comment |
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]),)
);
},
),
],
),
New contributor
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
add a comment |
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]),)
);
},
),
],
),
New contributor
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]),)
);
},
),
],
),
New contributor
edited yesterday
New contributor
answered yesterday
Epizon
645
645
New contributor
New contributor
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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