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

Bad performance of WebviewScaffold #386

Open
sz7i opened this issue Apr 14, 2019 · 0 comments
Open

Bad performance of WebviewScaffold #386

sz7i opened this issue Apr 14, 2019 · 0 comments

Comments

@sz7i
Copy link

sz7i commented Apr 14, 2019

I noticed a relatively high CPU consumption when using the WebviewScaffold. It happens even when there are no changes within the WebView. The flutter performance profiler shows that there 60 frames per second updated despite no visible state changes.

After some investigation I've found that the culprit is the default initial child instantiated in webview_scaffold.dart line 148

child: widget.initialChild ?? const Center(child: const CircularProgressIndicator()),

It looks like this animated widget stays running all the time even when it's not visible. A simple workaround was to provide

initialChild: Container(),

in the WebviewScaffold constructor. It definitely fixes the issue with frame updates and high CPU load and subjectively makes the WebView working smoother.

I'm not sure what's the best way of fixing it. Perhaps having an empty initial child by default or removing this child when a page is loaded. But some changes seems to be necessary.

BTW, thanks for the great plugin!

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