W
W
Wynell_ru2019-11-04 15:02:38
Android
Wynell_ru, 2019-11-04 15:02:38

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?
ogv9q31.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KnightForce, 2020-02-25
@KnightForce

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 question

Ask a Question

731 491 924 answers to any question