Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/df1df7dc81549a658729536f14861b05 to your computer and use it in GitHub Desktop.
Save ryanlid/df1df7dc81549a658729536f14861b05 to your computer and use it in GitHub Desktop.
AspectRatio 调整宽高比
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: "AspectRatio调整宽高比",
home: LayoutDemo(),
));
}
class LayoutDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("AspectRatio调整宽高比"),
),
body: Container(
height: 200.0,
child: AspectRatio(
aspectRatio: 1.5,
child: Container(
color: Colors.green,
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment