Flutter中常用的组件-Align(对齐)

//Align 是一个widget,用来包含另一个widget,并提供了alignment参数来对齐子widget的位置。
//Center 和 Align 非常相似。只有一个子部件,但 Center 总是将其子部件放在中心。
     

new Align(
        /**
         * alignment:默认值是 Alignment.center
         * alignment:Alignment.center:居中;Alignment.bottomCenter:底部居中;Alignment.topCenter:顶部居中;
         * alignment:Alignment.topLeft:顶部左侧;Alignment.centerLeft:中间左侧;Alignment.bottomLeft:底部左侧;
         * alignment:Alignment.topRight:顶部右侧;Alignment.centerRight:居中右侧;Alignment.bottomRight:底部右侧;
         */
        alignment: Alignment.topLeft,
        //widthFactor:默认为空,如果不为空时Align的宽度为子节点的宽度乘以widthFactorr赋值的宽度
        widthFactor: 2.0,
        //heightFactor:默认为空,如果不为空时Align的高度度为子节点的宽度乘以heightFactor赋值的宽度
        heightFactor: 2.0,
        //child:当前显示的组件Widget
        child: new ElevatedButton(onPressed: (){}, child: new Text("监管局"),),
      )

猜你喜欢

转载自blog.csdn.net/guliang28/article/details/128817602