-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
feat(widget): support adding padding to Block #20
Conversation
alpha-tango-kilo said: This would be awesome! I hope this gets merged 🙌 |
Hi, do you know when we can merge this PR? it would be great if this gets merged. Thanks! |
lgtm from me. |
I resolved the conflict, please review @mindoodoo @sayanarijit @sophacles @joshka |
Waiting for that one 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, and is functionality I was looking for not long ago. Curious about what you and the other reviewers think of my suggestion above
I'd suggest going left,right,top,bottom on the padding values instead of just horizontal/vertical. With vertical and horizontal being pub fields, that's a breaking change if done later. Padding will be useful to insert between other things (e.g. |
Nope, sorry, we need the values for each side, which isn't possible with bitwise API. |
LGTM (I think the only thing I can see is missing is a test for the left/right/top/bottom) |
Description
If we want to render a widget inside a block with a certain distance from its borders, we need to create another
Layout
element based on the outerBlock
, add a margin and render the Widget into it. Adding a padding property on the block element skips the creation of this second Layout.This property works especially when rendering texts, as we can just create a block with padding and use it as the text wrapper:
Rendering another widget should be easy too, using the
.inner
method:Testing guidelines
The
block.rs
example contains two cases of use: one with an inner text and another with an inner block:I've also changed the paragraph tests to include a padding of value 1 to the rendering tests.
Checklist