Padding主要有四种用法。
表示对Widget组件上下左右设置相同的内边距。
padding: EdgeInsets.all(8.0),
表示对Widget组件上下(vertical)和左右 (horizontal)设置相同的内边距。
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 15.0),
表示对Widget组件的上下左右设置不同的内边距。
padding: EdgeInsets.fromLTRB(10, 6, 10, 8),
可以Widget组件的上下左右中的其中一个单独设置内边距。
padding: EdgeInsets.only(top: 5),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children:<Widget> [
Padding(
// padding: EdgeInsets.all(8.0),
// padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 15.0),
// padding: EdgeInsets.fromLTRB(10, 6, 10, 8),
padding: EdgeInsets.only(top: 5),
child: Text(
'You have pushed this button many time'
),
),
Text(
'test 33333'
)
],
),
),