Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 17:00
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/343f3f0e939c8b9b2c9e997c673fffa9 to your computer and use it in GitHub Desktop.
Save ryanlid/343f3f0e939c8b9b2c9e997c673fffa9 to your computer and use it in GitHub Desktop.
SizedBox 设置具体尺寸
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