ConstrainedBox defined width and height

class LayoutDemoextends StatelessWidget {

@override

  Widgetbuild(BuildContext context) {

return new Scaffold(

appBar:new AppBar(

title: new Text ( 'ConstrainedBox defined width and height exemplary'),

      ),

      body:new ConstrainedBox(

constraints:const BoxConstraints(

minWidth:250.0,

          minHeight:150.0,

          maxWidth:320.0,

          maxHeight:220.0,

        ),

        child:new Container(

width:300.0,

          height:300.0,

          color: Colors.green,

        ),

      ),

    );

  }

}

Guess you like

Origin blog.csdn.net/weixin_33895604/article/details/90866674