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

[Bug]: Can't set border radius using an image #127

Open
jonas-martinez opened this issue Jun 27, 2023 · 2 comments
Open

[Bug]: Can't set border radius using an image #127

jonas-martinez opened this issue Jun 27, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jonas-martinez
Copy link
Contributor

jonas-martinez commented Jun 27, 2023

What happened?

It is impossible with the current state of the lenra components to use the border radius with an image. The container will properly use the radius but the image will just overflow in the corners.

A solution could be to use the Container.decoration.image property to assign an image to a container, then the border radius will work properly and we will still be able to customize the image.

Another solution would be to implement the ClipRRect widget that properly clips its child such as an image. This brings a new component on Lenra that is not straightforward to find but it could be used for other things than images (even though I can't think of any for the moment).

@jonas-martinez jonas-martinez added the bug Something isn't working label Jun 27, 2023
@jonas-martinez
Copy link
Contributor Author

jonas-martinez commented Jun 29, 2023

After some research and testing, it seems quite hard with the current way we handle the widgets on lenra_ui_runner to add a LenraImage into the Container.decoration.image property. Because a BoxDecoration is parsed by the props_parser, it is impossible to set the image property as a Child widget. It will be parsed as a property which required to redefine the whole LenraImage parsing file into the props_parser. Then, the image that is expected by the BoxDecoration.image is not a LenraImage nor a Image.network, it requires a DecorationImage with a NetworkImage as a child (note the difference between Image.network and NetworkImage, these are not the same widgets).

TLDR: We would need to create a specific DecorationImage + NetworkImage parsing which would differ from the LenraImage definition, which may confuse users.

The ClipRRect seems to be a good solution compared to the previous one but according to developers the ClipRRect needs more computing power so this might be bad for apps that use a lot of image clipping. It also adds a new component to Lenra which could be avoided.

We need to discuss this issue with the team. @lenra-io/devs

@taorepoara
Copy link
Member

This problem is linked to this issue: lenra-io/api#6

@taorepoara taorepoara transferred this issue from lenra-io/lenra_cli May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🟤 Can wait
Development

No branches or pull requests

2 participants