Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding around a widget #109

Closed
dlight opened this issue Oct 14, 2019 · 4 comments
Closed

Padding around a widget #109

dlight opened this issue Oct 14, 2019 · 4 comments
Labels
question Further information is requested
Milestone

Comments

@dlight
Copy link
Contributor

dlight commented Oct 14, 2019

Is there a way to set padding around a widget like ui::Image or ui::Text? I see that examples/image.rs, Text::height is used to set the height in pixels (and, since this was in a column, this results in some padding if the height is larger than the computed height of the text). In the same example, Column::spacing is used to set a constant amount of spacing between the itens of the column (but not before the first and after the last).

Both aren't what I'm looking for; there's also ui::core::Style::padding but I'm unsure how to use this with the current widgets (is it necessary to add a padding method to the widgets, like they have a height method? Shouldn't those methods be added to a trait?).

(ps: since the ui code is being moved to iced perhaps this issue belongs there, but coffee doesn't used iced yet)

@dlight
Copy link
Contributor Author

dlight commented Oct 14, 2019

It would be useful if ui::core::Style::padding could optionally add different amounts of padding to each side, like css - and have it exposed to each widget (letting the user either set the same amount for all 4 sides, or different amounts)

@hecrj
Copy link
Owner

hecrj commented Oct 14, 2019

You can wrap your widget in a Column and use Column::padding.

A different amount of padding per side is simply not supported yet. Styling in Iced will get reworked soon.

@hecrj
Copy link
Owner

hecrj commented Oct 14, 2019

For instance, the ui example uses it here:

.padding(20)

@hecrj hecrj added the question Further information is requested label Oct 14, 2019
@hecrj hecrj added this to the 0.4.0 milestone Oct 14, 2019
@dlight
Copy link
Contributor Author

dlight commented Oct 14, 2019

Thanks!

@hecrj hecrj closed this as completed Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants