字幕列表 影片播放
Sometimes, you just need a little bit of space.
有時,你只需要一點點空間。
Wait, no, not like that.
等等,不,不是這樣的。
I meant space between widgets.
我指的是部件之間的空間。
You can add padding or size boxes, but you'd have to know if the gap is inside a column or row to specify the direction that the space should expand.
您可以添加填充或大小框,但必須知道間隙是在列內還是行內,才能指定空間的擴展方向。
Both options can get verbose, potentially making your code harder to read.
這兩個選項都會變得冗長,可能導致代碼難以閱讀。
Instead, you can add a gap.
相反,您可以增加一個間隙。
It's like a size box, but you don't have to keep track of whether it's inside a row or column.
它就像一個尺寸框,但你不必記住它是在行內還是列內。
You always get a gap that takes up the specified space in the parent container's main access direction.
在父容器的主要訪問方向上總是會出現一個佔據指定空間的間隙。
It works inside scrollable widgets like ListViews, too.
它在 ListViews 等可滾動 widget 中也能使用。
If you're working with a small amount of space, avoiding overflow, maxGap will only fill the available space up to your specified size.
如果您使用的空間很小,為了避免溢出,maxGap 只會填充您指定大小的可用空間。
Finally, for some custom scrolling action, check out sliverGap. So next time you need some space, add a gap.
最後,如果需要自定義滾動操作,請查看 sliverGap。 下一次,當你需要一些空間時,添加一個間隙吧。
For more info on gap and all the other packages, head to pub.dev.
有關 gap 和所有其他套裝軟體的更多資訊,請訪問 pub.dev。