3

I have a Container that should take all available space, but not more than 500 x 500.

If I put it inside of Flexible or Expanded it will grow to take all the screen. Is there in Flutter something similar to android:maxWidth?

Vadims Savjolovs
  • 2,618
  • 1
  • 26
  • 51

1 Answers1

2

You can use BoxConstraints ,

    Container(
                constraints: BoxConstraints(
                    maxHeight: 500.0,
                    maxWidth: 500.0,
                    minHeight: 100.0,
                    minWidth: 100.0),
                child: YourChild(),

                )

More info: https://docs.flutter.io/flutter/rendering/BoxConstraints-class.html

diegoveloper
  • 93,875
  • 20
  • 236
  • 194