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')),//项目资源文件           ),         ),       ),     ),   ), ); }
原文地址:https://www.cnblogs.com/crane13/p/10902074.html