distributeWrapSpace function
(double, double)
distributeWrapSpace(
- WrapAlignment alignment,
- double freeSpace,
- double itemSpacing,
- int itemCount,
- bool flipped,
Implementation
(double leadingSpace, double betweenSpace) distributeWrapSpace(
WrapAlignment alignment,
double freeSpace,
double itemSpacing,
int itemCount,
bool flipped) {
assert(itemCount > 0);
return switch (alignment) {
WrapAlignment.start => (flipped ? freeSpace : 0.0, itemSpacing),
WrapAlignment.end => distributeWrapSpace(
WrapAlignment.start, freeSpace, itemSpacing, itemCount, !flipped),
WrapAlignment.spaceBetween when itemCount < 2 => distributeWrapSpace(
WrapAlignment.start, freeSpace, itemSpacing, itemCount, flipped),
WrapAlignment.spaceBetween => (
0,
freeSpace / (itemCount - 1) + itemSpacing
),
WrapAlignment.center => (freeSpace / 2.0, itemSpacing),
WrapAlignment.spaceAround => (
freeSpace / itemCount / 2,
freeSpace / itemCount + itemSpacing
),
WrapAlignment.spaceEvenly => (
freeSpace / (itemCount + 1),
freeSpace / (itemCount + 1) + itemSpacing
),
};
}