flutter组件学习
- flutter的Align组件
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Align组件',
home: Scaffold(
appBar: AppBar(title: Text('Align组件'),),
body: Container(
color: Colors.red,
child: Align(
// 宽高填充的倍数
widthFactor: 2.0,
heightFactor: 2.0,
// 对齐方式使用x,y来表示,范围从-1.0到1.0
alignment: Alignment(0.0, 0.0),
child: Container(
color: Colors.green,
width: 100,
height: 50,
child: Text('BottomCenter', style: TextStyle(color: Colors.white),),
),
),
),
),
);
}
}
- 效果图