Created with <3 with dartpad.dev.
Created
May 29, 2023 16:43
-
-
Save metal-young/8cb2335a4e3c2968847e89fac2ef9c45 to your computer and use it in GitHub Desktop.
rustic-kettle-9595
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(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Container 示例'), | |
), | |
body: Center( | |
child: Container( | |
// 设置 Container 的宽度 | |
width: 200.0, | |
// 设置 Container 的高度 | |
height: 200.0, | |
// 设置 Container 的边框和背景颜色 | |
decoration: BoxDecoration( | |
color: Colors.blue, | |
border: Border.all( | |
color: Colors.black, | |
width: 3.0, | |
), | |
), | |
// 设置 Container 的内边距 | |
padding: const EdgeInsets.all(10.0), | |
// 设置 Container 的外边距 | |
margin: const EdgeInsets.all(20.0), | |
// 设置 Container 的子组件 | |
child: Text( | |
'Hello Flutter', | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 24.0, | |
), | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment