SizedBox 和 Padding,Margin 的区别 [英] Difference between SizedBox and Padding,Margin

查看:17
本文介绍了SizedBox 和 Padding,Margin 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是否应该使用 Marging、Padding 或 SizedBox 来为小部件之间提供间距?

Should we use Marging,Padding or SizedBox to give spacing between widgets the Widgets the Margin and padding does the Work, so then whats the use of SizedBox

推荐答案

SizedBox 仅在小部件与小部件之间创建空间,只是高度和宽度.另一方面,边距是元素的个人空间——元素希望与其周围的其他元素保持多远的距离.填充是一个元素与自身的距离——一个元素想要与其内部的元素保持多远的距离.它们创建距离顶部、底部、左侧和右侧.

SizedBox creates space between widget to widget only just height and width. On the other hand, Margin is an element’s personal space — how much distance the element wants to keep with other elements around it. Padding is how much an element is away from itself — how much distance an element wants to keep with the elements inside it. They create distance top, bottom, left, and right.

这篇关于SizedBox 和 Padding,Margin 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆