Flutter容器类组件(Container)
Container
是最常用的容器类组件之一。
主要属性参如表所示:
宽300、高100的Container
,子组件是Text
且居中显示,四周红色圆角边框,代码如下:
Container(
width: 200,
height: 100,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
border:
Border.all(color: Colors.red, width: 1, style: BorderStyle.solid),
borderRadius: BorderRadius.all(Radius.circular(10))),
child: new Text("子控件"),
alignment: AlignmentDirectional.center,
)
运行效果如图所示:
酷客网相关文章:
评论前必须登录!
注册