Reputation: 89
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?
Upvotes: 0
Views: 564
Reputation: 677
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.
Upvotes: 1
Reputation: 365
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
Upvotes: 1