cspecial
cspecial

Reputation: 89

Make widget always expand to screen border

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

Answers (2)

JAgüero
JAgüero

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

Aimen SAYOUD
Aimen SAYOUD

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

Related Questions