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

Taking actual visible space #2

Open
creativecreatorormaybenot opened this issue Apr 19, 2021 · 0 comments
Open

Taking actual visible space #2

creativecreatorormaybenot opened this issue Apr 19, 2021 · 0 comments

Comments

@creativecreatorormaybenot

First up, this is a really cool package! Thanks for creating it ❤️

Use case

It would be useful if the DashedLine widget was the same size as the visible dashed line instead of the size of the control points.

Proposal

Add option to the DashedLine widget to take up the size that the displayed path will take up.

Current note

I am aware of the note you added to your README, however, I actually think it is somewhat misleading:

Due to how Paths work in Flutter and Skia, the DashedLine widget takes NOT as much space as the dashed line needs, but as much it needs to contain all the control points.

This suggests that this is a limit of the Flutter rendering engine while it is obviously not. You are free to define the size of your render objects however you please.

Implementation

I assume you are using Path.getBounds for the bounds of your DashedLine widget (I have not looked into the implementation).

This, of course, returns the control points. I am not sure if Path.computeMetrics makes figuring out the actual visible bounds any easier, but you can always calculate it yourself if the existing implementation does not provide it for you.
This is clearly possible and probably also fairly trivial (considering the existing work on bezier curves et al.)

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

1 participant