Daneel
Daneel

Reputation: 1183

Flutter - Dynamic widget positioning

I'm creating a widget for a Flutter app and was wondering about how to handle different screen sizes.

In the ideal situation, I have three FlatButtons side-by-side. But when I tested on a smaller screen, the last button was overflowing on the right side (there were black and yellow stripes on the screen and a message indicating the widget was overflowing).

My initial choice was to have the overflowing widget go under the first two in case of need, but how can I achieve this ?

More generally, what should I do to have a nice rendering of my widget even in cases of too small screens ?

Upvotes: 1

Views: 1960

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657058

I don't think there is a general answer. docs.flutter.io/flutter/widgets/Wrap-class.html might do for the mentioend use case. docs.flutter.io/flutter/widgets/MediaQuery-class.html allows you to do different layout depending on the screen size.

See also https://github.com/flutter/flutter/wiki/Creating-Responsive-Apps

Upvotes: 1

Related Questions