問題タブ [flutterwebviewplugin]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
400 参照

flutter - Delayed webview loading in flutter and have a progress indicator until the url has completely loaded

I wanted to perform the following:

  • When the Flutter page is loaded, I want the webview (using webview_flutter.dart library) to load 1 second later. After 1 second, the webview would be loaded, and start loading the url website. From the period the Flutter page is loaded until the url has completely loaded the page, I want a circular progress indicator to show the user the app is still running.

Below is the issue that I am facing:

  • When the page is loaded, I have a progress indicator running.
  • I also have a FutureBuilder to load the webview 1 second later and load an empty Container before 1 second.
  • After 1 second later, the FutureBuilder would load the webview and start loading the url.
  • After the url is loaded, it will have a callback from the onPageFinished and I called setState() to stop the progress indicator. However, calling setState() will reload the entire page and now the FutureBuilder is retriggers again.
  • If I add an "if-else" to prevent the FutureBuilder to load again, then the webview will flickers (even if I use the "key" parameters).

Is it possible to code what I am looking for in Flutter?