I am using InAppWebView to show the webpage in a flutter app. Here keyboard is shown only when I tap on the input field. Is there a way that the keyboard is visible before tapping on the input field? The keyboard should appear right after navigating to this screen. Here is the code:
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
class WebViewScreen extends StatefulWidget {
const WebViewScreen({Key? key}) : super(key: key);
@override
State<WebViewScreen> createState() => _WebViewScreenState();
}
class _WebViewScreenState extends State<WebViewScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: InAppWebView(
initialUrlRequest:
URLRequest(url: Uri.parse('https://www.google.com')),
onWebViewCreated: (InAppWebViewController controller) {
print('onWebViewCreated');
},
onProgressChanged:
(InAppWebViewController controller, int progress) {
print('onProgressChanged: $progress');
},
),
),
),
);
}
}
Using
addUserScript
method gives method implementation error.And using
webview_flutter
plugin, it works: