I have a problem with the visualization of a web page with webview_flutter, I have to display a web view, when I run the code on ios the view is displayed correctly, when I run the same code on android I have a blank page, how do I solve this thing? To what it is due, I report below the source codes
ReportView.dart
import 'dart:io';
import 'package:appsafetyeurope/model/Manutenzione.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
String URLLOAD = "https://marconisoftware.com";
class ReportView extends StatefulWidget {
final Manutenzione man;
final String token;
final String url;
const ReportView(this.man, this.token, this.url);
@override
createState() => ReportViewState();
}
class ReportViewState extends State<ReportView> {
void _handleLoad(String value) {}
@override
void initState() {
super.initState();
// Enable virtual display.
if (Platform.isAndroid) {
//WebView.platform = SurfaceAndroidWebView();
WebView.platform = AndroidWebView();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
iconSize: 20.0,
onPressed: () {
Navigator.pop(context);
},
),
centerTitle: true,
title: Text('Report')),
body: IndexedStack(
index: 0,
children: [
Column(
children: <Widget>[
Expanded(
child: WebView(
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
Map<String, String> headers = {"Cmdbuild-authorization": widget.token};
webViewController.loadUrl(
widget.url +
"/services/rest/v3/reports/286763/Activity%20report.pdf?extension=pdf¶meters=%7B%22ProcessId%22%3A" +
widget.man.id.toString() +
"%7D",
headers: headers);
},
onPageFinished: _handleLoad,
)),
],
),
Container(
color: Colors.white,
child: Center(
child: CircularProgressIndicator(),
),
),
],
));
}
}