logo头像
Snippet 博客主题

Flutter 控件 Center

本文于314天之前发表,文中内容可能已经过时。

Flutter 控件 Center

Center继承自Align,只不过是将alignment设置为Alignment.center,

其他属性例如widthFactor、heightFactor,布局行为,都与Align完全一样,在这里就不再单独做介绍了。

Center源码如下,没有设置alignment属性,是因为Align默认的对齐方式就是居中。

1
2
3
4
5
class Center extends Align {
/// Creates a widget that centers its child.
const Center({ Key key, double widthFactor, double heightFactor, Widget child })
: super(key: key, widthFactor: widthFactor, heightFactor: heightFactor, child: child);
}
支付宝打赏 微信打赏

打赏