void main() {
runApp(
new MaterialApp(
title: 'Demo',
home: new Scaffold(
appBar: new AppBar(
title: new Text('Demo'),
),
body: new Center(
child: new Container(
// color: Colors.red,
child: new AspectRatio(
aspectRatio:3/2, //横纵比 长宽比 3:2
child: new Image(image: new AssetImage('images/img1.jpg')),//项目资源文件
),
),
),
),
),
);
}
Flutter 宽高比(比率)控件
最新推荐文章于 2024-05-25 09:44:59 发布