I know its possible to add a WebView as a full page but couldn't find any sample code to do it. I assume you could use a PageView as it's base but not sure how to call the native android WebView and add it to the PageView.
Can anyone point me in the right direction?
Modify src/MainActivity. java file to add WebView code. Run the application and choose a running android device and install the application on it and verify the results. Following is the content of the modified main activity file src/MainActivity.
You can use https://pub.dartlang.org/packages/webview_flutter
example
import 'package:webview_flutter/webview_flutter.dart'; return Scaffold( appBar: AppBar( title: const Text('Flutter WebView example'), ), body: const WebView( initialUrl: 'https://flutter.io', javascriptMode: JavascriptMode.unrestricted, ), );
Flutter doesn't have built-in support for embedded WebViews. Follow issue 730 for updates.
You can still show web content in your app, but you'll have to leave Flutter-land using the plugin system.
If you just want to open a browser, you can use the url_launcher Flutter plugin.
If you want to do something fancier (perhaps you don't want a visible address bar), you could implement a custom UIViewController (iOS example) and Activity (Android example) and use the plugin API to launch into these.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With