[英]Make a widget expand to available space flutter
I'm trying tu put FlutterMap
in the right widget to expand it vertically depending on the device it' been drawn on.我正在尝试将FlutterMap
放在正确的小部件中,以根据绘制它的设备垂直扩展它。 So far it is in a Container with fixed heigh and width.到目前为止,它是在一个具有固定高度和宽度的 Container 中。 The same I'd need to do with the Drawer as when it opens it flows outside the screen on small iPhone 6 screen.我需要对 Drawer 做同样的事情,因为当它打开时,它会在 iPhone 6 的小屏幕上流到屏幕外。 Can you point me to a good explanation of the expanding widgets?你能指出我对扩展小部件的一个很好的解释吗? This is the code:这是代码:
body: SafeArea(
minimum: EdgeInsets.symmetric(horizontal: 20),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
height: 400,
width: 350,
child: FlutterMap()),
Row()]
Flutter widget Expanded
does that for you. Flutter widget Expanded
为您做到了这一点。 It has child
argument where you can put your Container
or FlutterMap
widget.它有child
参数,您可以在其中放置Container
或FlutterMap
小部件。
Also take a look at flex
property of Expanded
widget if you want to create proportions for several widgets.如果您想为多个小部件创建比例,还可以查看Expanded
小部件的flex
属性。
You can consider using the Expanded widget Try this您可以考虑使用Expanded小部件试试这个
SafeArea(
minimum: EdgeInsets.symmetric(horizontal: 20),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Container(
child: FlutterMap()),
),
Row()]
Hope it works for you希望这对你有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.