attribute
Const Padding({Key Key, @required this. Padding,// inner margin Widget child,})Copy the code
- EdgeInsets. All (12),// specify four values in the same direction
- EdgeInsets. FromLTRB (10, 20, 30, 40),// Specify the four directions
- EdgeInsets. Only (left: 10,right: 30),// Specify the value in any direction
- EdgeInsets. Symmetric (vertical: 10,horizontal: 50),// Specifies the left right or vertical direction (top, bottom).
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: ConstrainedBox( constraints: BoxConstraints.expand(), child: Padding-right (// padding-right: EdgeInsets. All (12),// padding-right: EdgeInsets. All (12),// padding-right: EdgeInsets. FromLTRB (10, 20, 30, 40),// padding-right: EdgeInsets. Only (left: 10,right: 30),// Padding-right: EdgeInsets. Symmetric (vertical: 10,horizontal: 50),// Specify the left right or vertical direction (top, bottom) child: Stack(fit: StackFit.expand, // children: <Widget>[ Container( child: Text( "444", style: TextStyle(backgroundColor: Colors.orange), ), color: Colors.grey, ), ], ), ), ), ); }}Copy the code