add gap extension - #19
Conversation
letsar
commented
Nov 10, 2023
Can you export it through a specific library called |
I gave the extension a package unique name so there wouldn't be any chance of collisions on the extension name itself. The method name and type extended combination is unique enough that I doubt there will be issues there. Discoverability and ease of use will be low if people have to add a second import line to use it. In the case of any collisions it can be ignored in the import. |
letsar
commented
Nov 10, 2023
I'm was not worried about name collisions but more about unwanted extensions popping in intellisense. But since VS Code provide them anyway through intellisense whether the library is imported or not, it does not matter. I'm not really convinced having more extensions would make Flutter code more readable in general, but if this PR gets a lot of traction (let's say at least 50 👍), I'll merge it and I'll add a |
I've implemented a similiar approach in my projects recently. But one additional thing I did, was to only add gap via the extension if there wasn't already a gap widget defined by the user in the list. This allows developers to adjust the spacing at a specific index without having to think about subtracting the spacing the addGap() extension adds. It also prevents cluttering the widget tree with multiple Gap Widgets behind each other. I would also argue, that adding this extension completes this library in a way, as developers currently dont have a simple go-to approach for adding overall spacing to multiple widgets although it is a (i guess) widely spread use-case. I'd also say that adding a seperate import is the way to go. |
LowLevelSubmarine
commented
Dec 18, 2023
If you dont feel like adding this functionality to this package itself, maybe creating another gap-official companion-package is acceptable? |
JesusHdez960717
commented
Jun 10, 2026
It would be great if it also brought something like this: extensionGapExtensionIntonint { Gapgap() =>Gap(toDouble());
}
extensionGapExtensionDoubleondouble { Gapgap() =>Gap(this);
}So we can use it like:
|
orestesgaolin
commented
Aug 21, 2026
Row has a |
This adds a gap extension to make it easier to evenly space Rows and Columns