Positioned (Flutter Widget of the Week)
Why Stack Overflow recommends it
Stack Overflow users link it when answering Flutter layout questions about placing or stretching a child inside a Stack with Positioned.
Recommended by 8 people across 8 different months, 2019 to 2022.
What it is
A 1.5 minute entry in Google's Flutter Widget of the Week series on the Positioned widget. It shows how to wrap a Stack's children in Positioned and set top, bottom, left, right, width and height, plus Positioned.fill to fill the Stack.
What people said
Recommends Ferdi · 2019-03 · Stack Overflow · on “Alignment of Widgets inside a container”
The thing is you're just not giving enough padding on the top side, try 100 ;) But the good practice is actually to wrap all into a SafeArea Widget For the positionning part you can use Center() Widget the wrap your column and make it into the center: Docs [LINK] You can also use Positionned() Widget to specified very clearly where it should be into your Container : Widget of the week [this video] and Docs [LINK] (seems really appropriate in your case) Also you can imagine using Column alignement property, for instance: child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ ...
Recommends Ferdi · 2019-03 · Stack Overflow · on “How to align center Y of widget to top edge of another”
Here I think the widget you're looking for is Positioned it's allow you to define a position in a Stack Widget and you can define height inside. Here are the link to Video widget of the week [this video] and Official doc [LINK] I am thinking to an other trick: You can define a height variable for you blue box and you can set a marginTop to your yellow Widget at precisely height/2 then your yellow block would always let half your blue box out. (It's working with this components but if it's included with more Widgets it may not do the trick) Hope it helps !!
Recommends Sean Urgel · 2019-04 · Stack Overflow · on “How to design a user center ui like this using dart”
You can use the Stack widget and a Positioned element to help you position the avatar in the right place. A quick video on the Positioned and Stack: [this video]
Recommends Alex.F · 2019-07 · Stack Overflow · on “Expand widgets inside the Stack widget”
Use Positioned.fill Stack( children: [ Positioned.fill( child: Column( children: [ //... ], ), ), //... ], ); More info about Positioned in Flutter Widget of the Week [this video] How does it work? This is all about constraints. Constraints are min/max width/height values that are passed from the parent to its children. In the case of Stack . The constraints it passes to its children state that they can size themselves as small as they want, which in the case of some widgets means they will be their "natural" size. After being sized, Stack will place its children in the top left corner. Positioned.fill gets the same constraints from Stack but passes different constraints to its child, stating the
Recommends Luis Miguel Mantilla · 2019-09 · Stack Overflow · on “Creating circles around an other circle”
You can use a Stack Widget [LINK] instead of the container, and also you can see this video [this video] to check how works the Positioned Widget.
Recommends haliltprkk · 2020-08 · Stack Overflow · on “Flutter Stack / Align”
The best widget to align something inside a Stack is the Positioned widget. I think it can solve your problem Positioned Widget [this video]
Recommends Aakash kondhalkar · 2021-01 · Stack Overflow · on “How do i center a text field horizontaly and vertically in flutter”
You are using a stack widget so if you want to align and positioned your widget inside the stack see the below options Wrap widget with Positioned widget if you want to change position Wrap widget with Align widget for alignment Check out this Video [this video] for how to use Positioned widget Check out this Video [LINK] for how to use Align widget
Recommends Musa Jahun · 2021-07 · Stack Overflow · on “How to align siblings in a row in flutter”
You can have a Row , under the Row , group the items into two, the first Container and another Container that contains the three other items, in the second Container , it's child should be a Stack , then use Positioned widget to position all three children. class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Container( width:MediaQuery.of(context).size.width, child: Row( children:[ Container( width:MediaQuery.of(context).size.width*0.10), Container( width:MediaQuery.of(context).size.width*0.9, child:Stack( children:[ Positioned( child:VerticallyAlighedAtStart()), Positioned( child:VerticallyAlighedAtEnd()), Positioned( child:VerticallyAlighedAtCente
Recommends Tawreos · 2022-09 · Stack Overflow · on “Flutter Stack Widget: Bound a layer's size to the size of the underlying layer”
I was having this same issue, and as of september 2022, @chunhunghan solution didn't work for me: final RenderBox yourRenderBox = _key.currentContext.findRenderObject(); is the line that breaks my code with: A value of type 'RenderObject?' can't be assigned to a variable of type 'RenderBox'. So I came up with another approach, inspired by flutter's Widget of the Week video about Positioned [this video] , where no Keys are needed, simply a Stack() with two layers: bottom is dynamic-sized, and top is wrapped inside a Positioned.fill() widget that will adapt to the bottom layer size automatically. Simplified code looks like this: class MyStackState extends State < MyStack > { bool _showOverlay = fal
Cites Benedikt J Schlegel · 2020-06 · Stack Overflow · on “Move child of Stack at the bottom of the screen”
To position widgets inside a stack you can use the Positioned widget. You can pass it left right top and bottom offsets to position whereever you like within the Stack. [this video]