Improvement: Refactor Gap widget
Closed this issue · 0 comments
leoafarias commented
The current version of the Gap widget has a lot of complexity in its behavior. A more straightforward implementation would be to use Padding
instead so it would add margins between the children. This will maintain the flex spacing behavior and create a more straightforward implementation.
Implementation
- Automated Spacing: The Gap widget should automatically insert appropriate spacing between the children of a flex container (Row or Column), adapting to the container's direction (horizontal or vertical).
- Directional Padding Application:
- In horizontal layouts, add padding to the
right
of each child. - In vertical layouts, add padding to the
bottom
of each child.
- In horizontal layouts, add padding to the
Exclude padding for the last child to avoid unnecessary trailing space.