//Center:Center 是一个小部件,它将唯一的子小部件放在其中心。Center 和 Align 非常相似。它们只有一个子部件,但 Align 允许我们自定义子部件在其中的位置。
new Center(
child: new Text("测试按钮"),
// widthFactor:如果不设置Center的宽度将尽可能大的填充,如果设置后Center的宽度即为子部件的宽度乘以widthFactor的设置值
widthFactor: 10.5,
// heightFactor:如果不设置Center的高度将尽可能大的填充,如果设置后Center的高度即为子部件的宽度乘以heightFactor的设置值
heightFactor: 10.0,
),
Flutter中常用的组件-Center
最新推荐文章于 2025-01-12 00:49:52 发布