当使用网上盘点——面盘包装时,把屏幕复读和键盘点到一个投入领域时,就永远不会出现。 该机通常按预期运作,除非点击援引键盘的外地。
复制的样本代码:
import package:webview_flutter/webview_flutter.dart ;
class PaymentWebView extends StatefulWidget {
static const path = "payments-web-view";
final String url;
const PaymentWebView({super.key, required this.url});
@override
State<PaymentWebView> createState() => _PaymentWebViewState();
}
class _PaymentWebViewState extends State<PaymentWebView> {
final controller = WebViewController()
..setBackgroundColor(const Color(0x00000000));
// ..setNavigationDelegate(
// NavigationDelegate(
// onProgress: (int progress) {
// // Update loading bar.
// },
// onPageStarted: (String url) {},
// onPageFinished: (String url) {},
// onWebResourceError: (WebResourceError error) {},
// onNavigationRequest: (NavigationRequest request) {
// return NavigationDecision.navigate;
// },
// ),
// );
@override
void initState() {
Future.microtask(() {
final size = MediaQuery.of(context).size;
final height = (size.height * 0.7).toInt().toString();
final width = (size.width * 0.9).toInt().toString();
controller.loadRequest(Uri.dataFromString( <html>
<head><meta name="viewport" content="width=device-width, initial-scale=1"></head><iframe src="${widget.url}" height=${height}px width=${width}px ></iframe></html> ,
mimeType: text/html ));
});
super.initState();
}
@override
Widget build(BuildContext context) {
print("Refreshed webview");
return Scaffold(
body: WebViewWidget(controller: controller),
);
}
}