We get the size of each widget in the layout by adding a "phantom" gap at the end, then divide the new width by the number of slots to get how wide each slot + its gap is.
This makes it each slot has a gap after it (the final slot gets the "phantom" gap), and so all slots get the same width (unlike before where the first and last slot were wider).
Furthermore this fixes a minor bug that occurs when you have a layout with just 1 item, where you would get a gap after it which makes it not take up the full width available. (This is unlikely to happen if you're designing the layout by hand, but could happen if you generate it from, say, a list of items)
We get the size of each widget in the layout by adding a "phantom" gap at the end, then divide the new width by the number of slots to get how wide each slot + its gap is.
This makes it each slot has a gap after it (the final slot gets the "phantom" gap), and so all slots get the same width (unlike before where the first and last slot were wider).
Furthermore this fixes a minor bug that occurs when you have a layout with just 1 item, where you would get a gap after it which makes it not take up the full width available. (This is unlikely to happen if you're designing the layout by hand, but could happen if you generate it from, say, a list of items)