I have a flutter app where can see several cards. These cards are clickable, and will show a InAppWebView with a custom made viewer, which exists on the website I link to. The loading of this InAppWebView is pretty taxing on the app however, and I would like to pre-load this as much as possible.
It is kinda hard to give a lot of details, since this is job-related and thus private information, so I can't be too specific. I am also the only one working with Flutter here, so no advice can be expected from colleagues.
I am hoping to reduce the loading times of the InAppWebView by having it opened in the background already, and then just swapping to the correct route instead of initializing it from scratch. The problem here is that the URL will change, but that can be handled inside the view instead of creating an entirely new InAppWebView.
In short: How do I create a widget/route in the background of my Flutter application, and swap to it when necessary?
Maybe you can use a Stack
and a Visibility
widgets ? like this:
bool _isWebPageVisible = false;
Stack(
children: <Widget>[
MainWidget(),
Visibility(
visible: _isWebPageVisible,
child: WebPageWidget()
]
)
And you could change _isWebPageVisible whenever needed. When visible, the WebPageWidget
will appear above the MainWidget
.