A Flutter plugin that allows you to add an inline WebView.

Overview

native_webview Pub Version

A Flutter plugin that allows you to add an inline WebView.

Motivation

There is already a useful library for working with WebViews in Flutter.

These libraries come with trade-offs such as simple implementation but lack features, or very advanced features and complex implementation.

native_webview is designed to provide users with a standard set of WebView features provided by iOS and Android while keeping the implementation simple.

Requirements

  • Dart: >=2.10.0 <3.0.0
  • Flutter: >=1.22.0 <2.0.0
  • Android: minSdkVersion 24, AndroidX, Kotlin, Chrome version >= 74.0.3729.185
  • iOS: iOS version >= 11.0, Xcode version >= 11, Swift

Getting Started

Usage

class InitialUrlScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Initial URL"),
      ),
      body: WebView(
        initialUrl: "https://flutter.dev",
      ),
    );
  }
}

If you want to see other examples, see example or see DartDoc.

Known issues

Run tests

  • There are tests in `example/integration_test/tests
  • You will need to launch the iOS simulator or Android emulator
make test
Comments
  • webview导致UI卡顿

    webview导致UI卡顿

    在iOS上,打开网页关闭后,其他页面会卡顿。

    日志如下:

    Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview] PID: 3117, TID: 628092, Thread name: io.flutter.1.raster, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 Flutter 0x0000000100b855d0 _ZN7flutter30FlutterPlatformViewsController11SubmitFrameEP15GrDirectContextNSt3__110shared_ptrINS_10IOSContextEEENS3_10unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS8_EEEE + 4932 5 Flutter 0x0000000100b9ea60 _ZN7flutter10IOSSurface11SubmitFrameEP15GrDirectContextNSt3__110unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS5_EEEE + 160 6 Flutter 0x0000000100e750c4 _ZN7flutter10Rasterizer13DrawToSurfaceERNS_9LayerTreeE + 604 7 Flutter 0x0000000100e75c00 _ZNSt3__110__function6__funcIZN7flutter10Rasterizer4DrawEN3fml6RefPtrINS2_8PipelineINS2_9LayerTreeEEEEEE3$1NS_9allocatorISA_EEFvNS_10unique_ptrIS7_NS_14default_deleteIS7_EEEEEEclEOSG + 116 8 Flutter 0x0000000100e753c4 _ZN7flutter10Rasterizer4DrawEN3fml6RefPtrINS_8PipelineINS_9LayerTreeEEEEE + 408 9 Flutter 0x0000000100e7bc10 _ZNSt3__110__function6__funcIZN7flutter5Shell14OnAnimatorDrawEN3fml6RefPtrINS2_8PipelineINS2_9LayerTreeEEEEENS4_9TimePointEE4$_30NS_9allocatorISB_EEFvvEEclEv + 100 10 Flutter 0x0000000100ba9948 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 1472 11 Flutter 0x0000000100bac074 ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0 + 32 12 CoreFoundation 0x0000000196b98134 E2D6A76B-6879-31A3-8168-DF49F94E17CD + 692532 13 CoreFoundation 0x0000000196b97e50 E2D6A76B-6879-31A3-8168-DF49F94E17CD + 691792 14 CoreFoundation 0x0000000196b9752c E2D6A76B-6879-31A3-8168-DF49F94E17CD + 689452 15 CoreFoundation 0x0000000196b9253c E2D6A76B-6879-31A3-8168-DF49F94E17CD + 668988 16 CoreFoundation 0x0000000196b91ba8 CFRunLoopRunSpecific + 424 17 Flutter 0x0000000100babf50 _ZN3fml17MessageLoopDarwin3RunEv + 88 18 Flutter 0x0000000100bab12c _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN3fml6ThreadC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEE3$0EEEEEPvSJ + 196 19 libsystem_pthread.dylib 0x000000019692fd98 _pthread_start + 156 20 libsystem_pthread.dylib 0x000000019693374c thread_start + 8

    opened by deboLing 5
  • Sometimes the screen flickers when using WebView

    Sometimes the screen flickers when using WebView

     $ flutter doctor
    
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale ja-JP)
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    [✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    [✓] Android Studio (version 3.6)
    [✓] IntelliJ IDEA Ultimate Edition (version 2019.3.4)
    [✓] VS Code (version 1.42.0)
    [✓] Connected device (2 available)
    
    • No issues found!
    
    android 
    opened by hisaichi5518 3
  • play video canot fullscreen

    play video canot fullscreen

    E/InputMethodManager( 7734): b/117267690: Failed to get fallback IMM with expected displayId=14 actual IMM#displayId=0 view=com.hisaichi5518.native_webview.NativeWebView{33c78f VFEDHVC.. .F...... 0,0-1440,2432}
    I/chromium( 7734): [INFO:CONSOLE(1)] "Uncaught (in promise) TypeError: fullscreen error", source: https://bobo.kkpp.space/DPlayer/DPlayer.min.js (1)
    
    opened by jjjachyty 2
  • black screen with android 10 and FLAG_SECURE

    black screen with android 10 and FLAG_SECURE

    webView show as black screen with FLAG_SECURE in all device not support Chrome as Android system WebView Provider

    in android 10 , and Huawei modern devices , can you supply any code to pass this issues

    opened by Joseph-Nathan 1
  • Attempt to read from field 'android.view.WindowManager$LayoutParams android.view.ViewRootImpl.mWindowAttributes' on a null object reference

    Attempt to read from field 'android.view.WindowManager$LayoutParams android.view.ViewRootImpl.mWindowAttributes' on a null object reference

    Sometimes the app crashes.

    D/AndroidRuntime( 8163): Shutting down VM
    E/AndroidRuntime( 8163): FATAL EXCEPTION: main
    E/AndroidRuntime( 8163): Process: ..., PID: 8163
    E/AndroidRuntime( 8163): java.lang.NullPointerException: Attempt to read from field 'android.view.WindowManager$LayoutParams android.view.ViewRootImpl.mWindowAttributes' on a null object reference
    E/AndroidRuntime( 8163): 	at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1626)
    E/AndroidRuntime( 8163): 	at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:1865)
    E/AndroidRuntime( 8163): 	at android.view.inputmethod.InputMethodManager.isActive(InputMethodManager.java:1184)
    E/AndroidRuntime( 8163): 	at com.hisaichi5518.native_webview.InputAwareWebView$1.run(InputAwareWebView.java:204)
    E/AndroidRuntime( 8163): 	at android.os.Handler.handleCallback(Handler.java:883)
    E/AndroidRuntime( 8163): 	at android.os.Handler.dispatchMessage(Handler.java:100)
    E/AndroidRuntime( 8163): 	at android.os.Looper.loop(Looper.java:214)
    E/AndroidRuntime( 8163): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
    E/AndroidRuntime( 8163): 	at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime( 8163): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    E/AndroidRuntime( 8163): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
    

    I haven't found a way to recreate it.

    bug android 
    opened by hisaichi5518 1
  • Suppress build warnings

    Suppress build warnings

    This PR is based on https://github.com/hisaichi5518/native_webview/pull/109, so will make this ready after merging it.

    Commits:

    • https://github.com/hisaichi5518/native_webview/commit/445a3aaa17709bd722d6b2a0dc34b0889de3d85e
    • https://github.com/hisaichi5518/native_webview/pull/110/commits/c28571db593466a287fb17f4f18a52400d545207
    opened by chuganzy 0
  • Upgrade Flutter and fix Android typing to align with the SDK

    Upgrade Flutter and fix Android typing to align with the SDK

    This PR is to make this package compatible with Flutter 3.3.x.

    No change was needed in iOS, but some were needed in Android for nullability updates in Flutter SDK.

    This PR also improves Android integration test's stability.

    opened by chuganzy 0
  • Support file upload on Android

    Support file upload on Android

    Support file upload on Android.

    Launch the picker intent when you tap the file selection button on the web page. Receives the result of the intent and calls a callback.

    opened by kitak 0
  • Fix tests

    Fix tests

    Running the integration test in CI is very unstable and reduces development speed. So, I will not run it in CI, but run it on my machine and then merge it.

    opened by hisaichi5518 0
  • onConsoleMessage

    onConsoleMessage

    Android

    https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)

    iOS

    none WKWebView should overwrite console.log.

    opened by hisaichi5518 1
Owner
hisaichi5518
#perl #ruby #android #java #kotlin #swift #golang #flutter
hisaichi5518
Flutter Image add drag sort, Image add drag sort, support click event, delete, add, long press drag sort.

flutter_image_add_drag_sort Flutter Image add drag sort, Image add drag sort, support click event, delete, add, long press drag sort, support video fi

null 5 Jun 23, 2020
Plugin that allow Flutter to communicate with a native WebView.

interactive_webview Plugin that allow Flutter to communicate with a native WebView. Warning: This is not a display WebView. This plugin is designed to

Duy Duong 46 Dec 15, 2022
A complete tutorial series on Flutter webview.

Flutter Webview | Tech With Sam Flutter Webview Tutorial - Watch on youtube ✌   App Preview App Screenshot App Screenshot A new Flutter project. Getti

Samuel Adekunle 43 Dec 30, 2022
Tech News Application by Flutter WebView .

Tech News APP developed by flutter_web_view Tech News developed by Flutter (Dart) it is a simple WebView that run on Android & iOS. *New changes: Migr

Hamed Jaliliani 34 Oct 31, 2021
A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready.

A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready. Getting started Gallery Basic usage Featu

null 2 Mar 17, 2022
A cross-platform WebView for Android, iOS and Web.

A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready. Getting started Gallery Basic usage Featu

Mahad Asghar 4 Dec 14, 2022
Custom dropdown widget allows to add highly customizable widget in your projects with proper open and close animations and also comes with form required validation.

Custom Dropdown Custom Dropdown package lets you add customizable animated dropdown widget. Features Lots of properties to use and customize dropdown

Abdullah Chauhan 22 Dec 29, 2022
Christianlyrics - Flutter plugin that allows you build lyrics srt type of song

christian_lyrics Flutter plugin that allows you build lyrics srt type of song. G

nguyen phuc nguyen 4 Dec 5, 2022
Flutter plugin that allows you to keep the device screen awake on Android, iOS, macOS, Windows, and web.

Wakelock Wakelock is Flutter plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping. Supported platforms Platfo

null 341 Jan 4, 2023
A Flutter plugin which allows you to execute code in the background on Android and iOS.

Flutter Workmanager Flutter WorkManager is a wrapper around Android's WorkManager, iOS' performFetchWithCompletionHandler and iOS BGAppRefreshTask, ef

Flutter Community 699 Jan 5, 2023
This package adds CustomRefreshIndicator widget that allows you to create whatever indicator you want.

Custom Refresh Indicator A flutter package that allows you to easily create a custom refresh indicator widget. TLDR; ONLINE DEMO! QUICK START CustomRe

Kamil Klyta 315 Dec 16, 2022
A flutter plugin to add login with facebook in your flutter app

Features Login on iOS, Android and Web. Express login on Android. Granted and declined permissions. User information, picture profile and more. Provid

Darwin Morocho 157 Jan 6, 2023
Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.

image_editor The version of readme pub and github may be inconsistent, please refer to github. Use native(objc,kotlin) code to handle image data, it i

FlutterCandies 317 Jan 3, 2023
Awesome Notifications add-on plugin to enable push notifications through Firebase Cloud Messaging with all awesome notifications features.

Awesome Notifications FCM Awesome Notifications add-on to send push notifications using FCM (Firebase Cloud Messaging), with all awesome notifications

Rafael Setragni 8 Jan 4, 2023
This is a Flutter app which shows how to add a Fitted Box in you App

fittedbox A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Shehzaan Mansuri 1 Oct 25, 2021
A Flutter add-to-app demo you can try with your own apps

Put Flutter to Work ?? Hello! This project is a demo intended to help people test drive Flutter by integrating it into their existing applications. In

Flutter 280 Jan 8, 2023
Asset manager helps you auto-generate the assets code and add it to your pubspec.yaml .

Asset Manager Asset manager helps you auto-generate the assets code and add it to your pubspec.yaml . Quick start dart pub global activate asset_manag

Rutvik Tak 9 Nov 1, 2022
Boris Gautier 1 Jan 31, 2022
This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc.

screen_retriever This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc. screen_retriever P

LeanFlutter 27 Dec 6, 2022