Es imprescindible entender el código correctamente antes de adaptarlo a tu trabajo y si ttienes algo que aportar puedes decirlo en los comentarios.
Ejemplo 1: vista web en Android Studio
private WebView webView;
protected voidonCreate(Bundle savedInstanceState)super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);
webView =(WebView)findViewById(R.id.webview);
webView.setWebViewClient(newWebViewClient());
webView.loadUrl("https://www.javatpoint.com/java-tutorial");
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
public voidonBackPressed()if(webView.canGoBack())
webView.goBack();elsesuper.onBackPressed();
Ejemplo 2: webview flutter dev
dependencies:
webview_flutter:^0.3.22+1
Ejemplo 3: agregar vista web en Flutter
A Flutter plugin that provides a WebView widget.
On iOS the WebView widget is backed by a WKWebView; On Android the WebView widget is backed by a WebView.
Usage
Add webview_flutter as a dependency in your pubspec.yaml file.
You can now include a WebView widget in your widget tree. See the WebView widget's Dartdoc for more details on how to use the widget.
Android Platform Views
The WebView is relying on Platform Views to embed the Android’s webview within the Flutter app. By default a Virtual Display based platform view backend is used,this implementation has multiple keyboard. When keyboard input is required we recommend using the Hybrid Composition based platform views implementation. Note that on Android versions prior to Android 10 Hybrid Composition has some performance drawbacks.
Using Hybrid Composition
To enable hybrid composition,set WebView.platform =SurfaceAndroidWebView();ininitState(). For example:import'dart:io';import'package:webview_flutter/webview_flutter.dart';classWebViewExampleextendsStatefulWidget
WebViewExampleState createState()=>WebViewExampleState();classWebViewExampleStateextendsState<WebViewExample>voidinitState()super.initState();// Enable hybrid composition.if(Platform.isAndroid) WebView.platform =SurfaceAndroidWebView();
Widget build(BuildContext context)returnWebView(
initialUrl:'https://flutter.dev',);SurfaceAndroidWebView() requires API level 19. The plugin itself doesn't enforce the API level, so if you want to make the app available on devices running this API level or above, add the following to <your-app>/android/app/build.gradle:
android
defaultConfig // Required by the Flutter WebView plugin.
minSdkVersion 19
Ejemplo 4: webview_flutter
dependencies:
webview_flutter:^1.0.7
Ejemplo 5: webview_flutter
dependencies:
url_launcher:^5.7.10
Aquí puedes ver las reseñas y valoraciones de los lectores
Si te sientes suscitado, tienes el poder dejar una reseña acerca de qué te ha gustado de esta noticia.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)