Flutter 宽高比(比率)控件 AspectRatio


const AspectRatio({
Key key,
@required this.aspectRatio,
Widget child,
})

void
main() {  runApp(    new MaterialApp(      title: 'Demo',      home: new Scaffold(        appBar: new AppBar(          title: new Text('Demo'),       ),        body: new Center(          child: new Container(            child: new AspectRatio(              aspectRatio:3/2, //横纵比 长宽比 3:2              child: new Image(image: new AssetImage('images/demo.jpg')),//项目资源文件           ),         ),       ),     ),   ), ); }

 

posted @ 2019-05-21 20:14  crane13  阅读(1643)  评论(0编辑  收藏  举报