Flutter 宽高比(比率)控件 AspectRatio

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

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')),//项目资源文件
            ),
          ),
        ),
      ),
    ),
  );
}

 

你可能感兴趣的:(Android,flutter)