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

Expand FlareActor to fill parent #273

Open
doppio opened this issue Aug 11, 2020 · 1 comment
Open

Expand FlareActor to fill parent #273

doppio opened this issue Aug 11, 2020 · 1 comment

Comments

@doppio
Copy link

doppio commented Aug 11, 2020

Hello!

I'm trying to fit a FlareActor to its parent by width, which I can by providing a fit of BoxFit.contain and setting the sizeFromArtboard parameter to true. The size of the rendered art is correct, but the widget takes up much more vertical space than necessary. It seems like it should be possible for the FlareActor to size itself such that it fills up constraints as much as possible, while maintaining its native aspect ratio. Is this already supported?

@luigi-rosso
Copy link
Contributor

Hey @doppio, yes you can do that! You'd want sizeFromArtboard to be false in this case and set fit to BoxFit.contain. That'll take up the full size of the parent and then scale down whichever side exceeds the boundaries based on the aspect. If you specifically want to fit the width, try setting fit to BoxFit.width instead, but note that the height may bleed if the aspect of the artboard is inverted from that of the container. Take a peek at https://api.flutter.dev/flutter/painting/BoxFit-class.html for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants