Created
February 15, 2020 17:00
-
-
Save ryanlid/343f3f0e939c8b9b2c9e997c673fffa9 to your computer and use it in GitHub Desktop.
SizedBox 设置具体尺寸
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: "SizedBox设置具体尺寸示例", | |
home: LayoutDemo(), | |
)); | |
} | |
class LayoutDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("SizedBox设置具体尺寸示例"), | |
), | |
body: SizedBox( | |
// 固定宽 200.0 高 300.0 | |
width: 200.0, | |
height: 300.0, | |
child: Card( | |
child: Text( | |
"SizedBox", | |
style: TextStyle(fontSize: 36.0), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment