Created
February 15, 2020 17:06
-
-
Save ryanlid/df1df7dc81549a658729536f14861b05 to your computer and use it in GitHub Desktop.
AspectRatio 调整宽高比
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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