Padding组件处理容器与子元素之间的间距。
![](https://img2023.cnblogs.com/blog/3090884/202311/3090884-20231116102910661-976787420.png)
class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(20), child: const Icon(Icons.abc_outlined), ); } } class MyApp1 extends StatelessWidget { const MyApp1({super.key}); @override Widget build(BuildContext context) { return const Padding( padding: EdgeInsets.all(20), child: Icon(Icons.abc_outlined), ); } }