EdgeInsets.all();统一设置
EdgeInsets.formLTRB(value1,value2,value3,value4)
- margin外边距属性的使用
- decoration属性制作彩色背景
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "TextWidget",
home: Scaffold(
appBar: AppBar(
title: Text("TextWidget"),
),
body: Center(
child: Container(
child: Text(
"hello cookie",
style: TextStyle(
fontSize: 14.0,
),
),
alignment: Alignment.center,
width: 500.0,
height: 400.0,
//color: Colors.amberAccent,
//padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Colors.lightBlue,
Colors.greenAccent,
Colors.purple,
]
)
) ,
margin: const EdgeInsets.all(10.0),
),
),
));
}
}