【发布时间】:2020-12-02 01:12:38
【问题描述】:
我正在开发一个 Flutter 应用程序,并且我正在尝试创建一个 InAppWebView。在 Android 上一切正常,但在 iOS 上出现错误:
“列的子项不得包含任何空值,但在索引 0 处找到空值”。
我已经点击了 Flutter clean、flutter build ios 和 clean xcode。但是还是出现这个错误。
感谢任何帮助
这是我的代码:
child: Scaffold(
appBar: AppBar(title: Text("voucherweb")),
body: Container(
child: Column(children: <Widget>[
progress == null ? Container() : (progress != 1.0)
? LinearProgressIndicator(
value: progress,
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation<Color>(Colors.black))
: null,
Expanded(
child: Container(
child: InAppWebView(
initialUrl: "https://voucherweb.com",
initialHeaders: {},
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
useShouldOverrideUrlLoading: true),
),
shouldOverrideUrlLoading: (controller, request) async {
var url = request.url;
var uri = Uri.parse(url);
if (request.url.startsWith("https://wa.me/")) {
final newString =
url.replaceAll("https://wa.me/", "");
if (await canLaunch(url)) {
FlutterOpenWhatsapp.sendSingleMessage(
newString, "Halo, gan. Mau order voucher : ");
return ShouldOverrideUrlLoadingAction.CANCEL;
}
}
return ShouldOverrideUrlLoadingAction.ALLOW;
},
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart:
(InAppWebViewController controller, String url) {},
onLoadStop:
(InAppWebViewController controller, String url) {},
onProgressChanged:
(InAppWebViewController controller, int progress) {
setState(() {
this.progress = progress / 100;
});
}),
),
),
]))));
【问题讨论】: