
上QQ阅读APP看书,第一时间看更新
3.1.5 容器类组件(Container)
Container是最常用的容器类组件之一,主要属性参见表3-8。
表3-8 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, )
运行效果如图3-12所示。

图3-12 Container组件效果