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

Why is the delay property in captureFromWidget needed? #64

Open
aytunch opened this issue Jul 21, 2021 · 1 comment
Open

Why is the delay property in captureFromWidget needed? #64

aytunch opened this issue Jul 21, 2021 · 1 comment

Comments

@aytunch
Copy link

aytunch commented Jul 21, 2021

We have a Duration field called delay which defaults to 1 second inside of captureFromWidget

In which cases should we change it? and is it safe between different devices? For instance would an old android device need a higher delay? is it about performance?

In the code it states:

Value for [delay] should increase with widget tree size. Prefered value is 1 seconds

@kvenn
Copy link

kvenn commented May 30, 2023

I'd also like to know this the Readme covers it a little, but I'm curious if there's a heuristic other than trial-and-error to figure out how short the delay can be.

Relevant bit

Sometimes rastergraphics like images may not be captured by the plugin with default configurations. The issue is discussed here.

...screenshot is taken before the GPU thread is done rasterizing the frame
so the screenshot of the previous frame is taken, which is wrong.

The solution is to add a small delay before capturing.

screenshotController.capture(delay: Duration(milliseconds: 10))

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