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

Stroke position is different for Decoration vs SVG output #90

Open
gskinner opened this issue Dec 18, 2020 · 2 comments
Open

Stroke position is different for Decoration vs SVG output #90

gskinner opened this issue Dec 18, 2020 · 2 comments
Labels
bug Something isn't working flutter

Comments

@gskinner
Copy link
Collaborator

Bug Description

Flutter only supports inner strokes (aka borders) on BoxDecoration, but the SVG export is currently using centered strokes on shapes. This means that strokes display differently if a rectangle is exported as a Container vs as a SVG shape.

If possible, perhaps SVG export could either use inner (for consistency), or support all three options with a warning for Containers.

@gskinner gskinner added the bug Something isn't working label Dec 18, 2020
@gskinner
Copy link
Collaborator Author

gskinner commented Dec 30, 2020

Unfortunately, this isn't easily solved within the current framework. SVG only supports center strokes, and Flutter only supports inner strokes.

It may be possible to default to inner strokes via the clipping approach mentioned in the link above, but that adds complexity and may have runtime performance implications.

It's worth noting that XD does support converting these strokes into SVG (via layering a solid fill representing the stroke), and it is available via the application.createRenditions API. It would be worth taking a look into this to see if it can be used to solve this, though it may introduce other issues for how we export shapes (ie. we would likely need to rewrite parts of the generated SVG to modify transformations and apply opacity).

@gskinner
Copy link
Collaborator Author

Note that unsupported Container strokes currently generate a warning, but SVG strokes do not. We should add the latter.

gskinner added a commit that referenced this issue Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flutter
Projects
None yet
Development

No branches or pull requests

1 participant