/**
const Align({
Key key,
this.alignment = Alignment.center,//对齐方式,系统预设了9种对齐方式,也可以自定义Alignment(0.4,0.5),
其中第一个参数,-1.0是左边对齐,1.0是右边对齐,第二个参数,-1.0是顶部对齐,1.0是底部对齐。
this.widthFactor,//宽是子组件的倍数,Align的宽度就是child的宽度乘以这个值
this.heightFactor,//高是子组件的倍数,Align的高度就是child的高度乘以这个值
Widget child
})
*/
body:ListView(
children: <Widget>[
Container(
color: Color(0xfff1f1f1),
child: Align(
alignment: Alignment.bottomLeft,
widthFactor: 3,
heightFactor: 2,
child: Text("Alignment.bottomLeft"),
),
),
Container(
color: Color(0xfff1f1f1),
margin: EdgeInsets.only(top: 10.0),
child: Align(
alignment: Alignment(0.4, 0.5),
widthFactor: 3,
heightFactor: 2,
child: Text("Alignment(0.4, 0.5)"),
),
),
],
)
/**
const Padding({
Key key,
@required this.padding,//padding值
Widget child,
})
*/
body: Container(
color: Color(0xfff1f1f1),
child: Padding(
padding: EdgeInsets.all(50.0),
child: Text("padding组件"),
),
)
/**
Center继承自Align,只是将alignment设置为Alignment.center
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);
}
*/
body:Container(
color: Color(0xfff1f1f1),
child: Center(
widthFactor: 2,
heightFactor: 2,
child: Text("center组件"),
),
)
/**
const Baseline({
Key key,
@required this.baseline, baseline数值,必须要有,从顶部算
@required this.baselineType, alphabetic:对齐字符底部的水平线; ideographic:对齐表意字符的水平线。
Widget child
})
*/
body: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 5.0),
child: Baseline(
baseline: 40.0,
baselineType: TextBaseline.alphabetic,
child: Text("文本",),
),
),
Padding(
padding: EdgeInsets.only(left: 5.0),
child: Baseline(
baseline: 40.0,
baselineType: TextBaseline.alphabetic,
child: Text("ajfajf",),
),
),
Padding(
padding: EdgeInsets.only(left: 5.0),
child: Baseline(
baseline: 40.0,
baselineType: TextBaseline.ideographic,
child: Text("文本",),
),
),
Padding(
padding: EdgeInsets.only(left: 5.0),
child: Baseline(
baseline: 40.0,
baselineType: TextBaseline.ideographic,
child: Text("ajfajf",),
),
),
Padding(
padding: EdgeInsets.only(left: 5.0),
child: Baseline(
baseline: 10.0,
baselineType: TextBaseline.ideographic,
child: Text("ajfajf",),
),
),
Padding(
padding: EdgeInsets.only(left: 5.0),
child: Baseline(
baseline: 10.0,
baselineType: TextBaseline.ideographic,
child: Container(
color: Color(0xfff1f1f1),
child: Baseline(
baseline: 5.0,
baselineType: TextBaseline.ideographic,
child: Text("ajfajf",),
),
)
),
),
],
)
网友评论