Flutter: bottom center widget in stackCan (should?) Stack expand its size to its positioned children?Flutter position stack widget in centerHow to offset a scaffold widget in Flutter?Flutter : Bad state: Stream has already been listened toHow to make a widget animate based on child's size?How to correctly set height for the list viewStack inside Stack in flutterFlutter Layout RoadblockHow to vertically align Text inside ContainerFlutter - Positioned Widget in Stack causing Exception
Is "remove commented out code" correct English?
Neighboring nodes in the network
90's TV series where a boy goes to another dimension through portal near power lines
Emailing HOD to enhance faculty application
Is it legal for company to use my work email to pretend I still work there?
What is the most common color to indicate the input-field is disabled?
Assassin's bullet with mercury
How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?
What's the point of deactivating Num Lock on login screens?
How can I tell someone that I want to be his or her friend?
What mechanic is there to disable a threat instead of killing it?
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
Anagram holiday
How is it possible to have an ability score that is less than 3?
Facing a paradox: Earnshaw's theorem in one dimension
Intersection of two sorted vectors in C++
Theorems that impeded progress
Is there a hemisphere-neutral way of specifying a season?
What do you call someone who asks many questions?
How can I fix/modify my tub/shower combo so the water comes out of the showerhead?
How to prevent "they're falling in love" trope
What's the difference between 'rename' and 'mv'?
Why do I get two different answers for this counting problem?
What is going on with Captain Marvel's blood colour?
Flutter: bottom center widget in stack
Can (should?) Stack expand its size to its positioned children?Flutter position stack widget in centerHow to offset a scaffold widget in Flutter?Flutter : Bad state: Stream has already been listened toHow to make a widget animate based on child's size?How to correctly set height for the list viewStack inside Stack in flutterFlutter Layout RoadblockHow to vertically align Text inside ContainerFlutter - Positioned Widget in Stack causing Exception
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I wanna achieve like this pic. to simplify I created a stack that contains two Containers. i want to bottom center the small container using Align widget but its not working! it is always remaining at the top
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
)
],
),
dart flutter flutter-layout
add a comment |
I wanna achieve like this pic. to simplify I created a stack that contains two Containers. i want to bottom center the small container using Align widget but its not working! it is always remaining at the top
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
)
],
),
dart flutter flutter-layout
add a comment |
I wanna achieve like this pic. to simplify I created a stack that contains two Containers. i want to bottom center the small container using Align widget but its not working! it is always remaining at the top
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
)
],
),
dart flutter flutter-layout
I wanna achieve like this pic. to simplify I created a stack that contains two Containers. i want to bottom center the small container using Align widget but its not working! it is always remaining at the top
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
)
],
),
dart flutter flutter-layout
dart flutter flutter-layout
edited Mar 8 at 0:53
M.Ali
asked Mar 7 at 23:57
M.AliM.Ali
520217
520217
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try wrap your container into a Column and use axis align properties.
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
//width: MediaQuery.of(context).size.width, In my test this line causes bad behavior
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Column(
mainAxisAlignment: MainAxisAlignment.end, // start at end/bottom of column
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center( // center in horizontal axis
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
],
),
],
),
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
add a comment |
How about this?
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Positioned(
bottom: -30,
left: 0,
right: 0,
child: Center(
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
)
],
),
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
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%2f55054721%2fflutter-bottom-center-widget-in-stack%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try wrap your container into a Column and use axis align properties.
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
//width: MediaQuery.of(context).size.width, In my test this line causes bad behavior
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Column(
mainAxisAlignment: MainAxisAlignment.end, // start at end/bottom of column
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center( // center in horizontal axis
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
],
),
],
),
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
add a comment |
Try wrap your container into a Column and use axis align properties.
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
//width: MediaQuery.of(context).size.width, In my test this line causes bad behavior
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Column(
mainAxisAlignment: MainAxisAlignment.end, // start at end/bottom of column
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center( // center in horizontal axis
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
],
),
],
),
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
add a comment |
Try wrap your container into a Column and use axis align properties.
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
//width: MediaQuery.of(context).size.width, In my test this line causes bad behavior
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Column(
mainAxisAlignment: MainAxisAlignment.end, // start at end/bottom of column
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center( // center in horizontal axis
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
],
),
],
),
Try wrap your container into a Column and use axis align properties.
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
//width: MediaQuery.of(context).size.width, In my test this line causes bad behavior
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Column(
mainAxisAlignment: MainAxisAlignment.end, // start at end/bottom of column
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center( // center in horizontal axis
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
],
),
],
),
answered Mar 8 at 0:29
Marcos BoaventuraMarcos Boaventura
603312
603312
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
add a comment |
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
why should i use column here? what is the problem with align widget?
– M.Ali
Mar 8 at 0:54
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
To be sincere I've never used Align widgets. I always make alignment with axis properties and Flex factors. Anyway after your question update now it's more clear what kind of effect you want and the column approach will not work in this case. Sorry about it.
– Marcos Boaventura
Mar 8 at 1:19
add a comment |
How about this?
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Positioned(
bottom: -30,
left: 0,
right: 0,
child: Center(
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
)
],
),
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
add a comment |
How about this?
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Positioned(
bottom: -30,
left: 0,
right: 0,
child: Center(
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
)
],
),
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
add a comment |
How about this?
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Positioned(
bottom: -30,
left: 0,
right: 0,
child: Center(
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
)
],
),
How about this?
Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 170,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0))),
// child: Image.network(tutorImage),
),
Positioned(
bottom: -30,
left: 0,
right: 0,
child: Center(
child: Container(
width: 60,
height: 60,
color: Colors.black,
),
),
)
],
),
edited Mar 8 at 2:55
answered Mar 8 at 0:26
dshukertjrdshukertjr
1,9922930
1,9922930
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
add a comment |
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
its centered correctly, but there is a problem with this implementation. i want to overlap the small container like in the image above. when i set top : 50 or greater the container squeezes!
– M.Ali
Mar 8 at 0:58
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
@M.Ali You do not need to use top. I will edit my answer to show you how you can do it.
– dshukertjr
Mar 8 at 2:57
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.
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%2f55054721%2fflutter-bottom-center-widget-in-stack%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