Make widget always expand to screen border

Viewed 67

Is there a way to make a widget, for instance a Container, always expand to a screen border, not dependent of a specific widget tree structure?

2 Answers

Containers impose constraints on their children so you can't make a child's width bigger than its parent when it is a container

some tips : you can use the Expanded widget to take all the remaining space

to take all the size of the screen you can use width: double.infinity

As they said already, in Container() you can use width: double.infinity or width: MediaQuery.of(context).size.width. But for this, the parent of Container can't have a size smaller than the screen.

Related