My app is built using UI Builder, and then wrapped into the Backendless Native Mobile App Shell.
I am using the “Open Web Page” block to open a URL. This URL can be HTML, PDF or an image. When loading an image, the image opens up, but at such a high zoom level that the user cannot see that the image is open ! He thinks the page is all black and has to unzoom in order to see the image.
How can I load the image so that it fits within the viewport ?
Thanks for your help.
Edit : This happens on Android. On iPhone the zoom level is OK.
This is a highly annoying issue, and users are providing feedback that the image was not loaded when in fact it is loaded but zoomed in and the display is all black.
I find a solution.
Perhaps it’s not perfect. But the WebView we use does not yet provide the best tools.
In order to do this, you need to check the url to make sure it’s a real image (there are several options here, including sending information through the bridge using the UI buider). In my test case, I made it much easier, just checking the url for “.jpg”, but the image types can be different, so it should be expanded, or some other way should be used.
After you have made sure that this is a picture, you need to zoom out using the webview controller.
Here’s how I did it:
if (io.Platform.isAndroid) {
if (url.toString().contains('.jpg')) {
await controller.zoomBy(zoomFactor: 0.02);
}
}
file: web_view_container.dart.
I added this code after prints of progress in onLoadStop listener.