Answer the question
In order to leave comments, you need to log in
How to put a widget in the center of the screen, ignoring the column?
There is a widget (using text as an example). In a real example, it comes after another widget in Colum. How to put it in the center of the ecorun? As I understand it, Column does not. How can I do that? Or are there other ways to set the position of elements?
Answer the question
In order to leave comments, you need to log in
Center Widget.
But see that what it will be in full screen.
If it turns out that the Container has shrunk to the size of a child, then option 2:
1) Take all the available width and height.
width: double.infinity
height: double.infinity
2) Get screen dimensions:
Size size = Mediaquery.of(context).size;
width: size.width
height: size.height
But if some other parent with padding is added, then the sizes will not fit, since they do not take up all the available space, but a value equal to the screen size.
Screen width 300, padding 10 - step 1 will take 290, and step 2. screen sizes - 300 and it turns out that the widget got out by 10.
Therefore, option 1 is preferable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question