How to Set Min Width and Min Height of a Container in Flutter

If you’re looking to create a specific size for your container in Flutter, you can use the minWidth and minHeight settings. This will constrain the size of the container to be at least as large as the values you specify.

Flutter has a convenient Container class that allows you to store, position and size any number of widgets on your screen. The basic idea behind it is like storing things in boxes!

The Container widget has BoxConstraints property that allows specifying the maximum and minimum width and height of the child widget inside it.

Here is an example showing how to set minWidth and minHeight for a Container:

  constraints: BoxConstraints(
      minHeight: 100, minWidth: double.infinity),
  child: ListView(
    shrinkWrap: true,
    children: [
        (index) => Padding(
          padding: const EdgeInsets.all(8.0),
          child: Text(
            'Text: ${index}'

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.