flutter_inappwebview

repository·master·Indexed 25 days ago

https://github.com/pichillilorenzo/flutter_inappwebview

A comprehensive Flutter plugin for integrating advanced webview functionalities, including inline, headless, and in-app browser windows. It supports multiple platforms including Android, iOS, macOS, Windows, Linux (via WPE WebKit), and Web. The plugin is implemented as an endorsed federated plugin with platform-specific implementations for each supported OS.

Tokens
7.6K
Snippets
11
Records
45
Agent score
86%

What's inside flutter_inappwebview

  1. Overview of Flutter InAppWebView Plugin

    master

    The flutter_inappwebview plugin provides advanced webview capabilities for Flutter applications. It allows developers to:

    • Add an inline webview directly into the widget tree.
    • Use a headless webview for background tasks or logic without a visible UI.
    • Open an in-app browser window for a native-like browsing experience.

    It supports multiple platforms including Android, iOS, macOS, Windows, Linux, and Web.

  2. Configure WPE WebKit backend for flutter_inappwebview_linux

    master

    The flutter_inappwebview_linux plugin uses WPE WebKit for offscreen web rendering. It is designed for headless/offscreen rendering without a GTK widget hierarchy, offering excellent GPU integration via DMA-BUF for zero-copy texture sharing with Flutter. This makes it suitable for embedded systems like Raspberry Pi, set-top boxes, and kiosks.

    The plugin supports two backend APIs, which are selected automatically at compile time based on available packages:

  3. Configure WPE WebKit Build Flags for flutter_inappwebview

    master

    WPE WebKit features many optional components enabled by default. If you lack the dependencies, you must either install them or disable the feature using -D<FLAG>=OFF during the CMake configuration step.

    Critical for this plugin: To use the modern WPEPlatform backend (the default for this plugin), you must enable the following flags:

    • ENABLE_WPE_PLATFORM=ON
    • ENABLE_WPE_PLATFORM_HEADLESS=ON

    If these are disabled, the plugin will fall back to the legacy WPEBackend-FDO.

  4. Build a Flutter Linux app with WPE WebKit backend

    master

    The flutter_inappwebview_linux plugin automatically detects WPE libraries via pkg-config. When WPE is found, the plugin compiles with the WPE backend and bundles the necessary libraries into your app's lib/ directory. This allows the app to run without requiring LD_LIBRARY_PATH to be set manually.

    To build your application for release, run the standard Flutter build command from your project root.

    cd your_flutter_app
    flutter build linux --release
  5. Use flutter_inappwebview_ios in your project

    master

    This package is an endorsed federated plugin. It is automatically included in your app when you use the main flutter_inappwebview package, so you do not need to add flutter_inappwebview_ios to your pubspec.yaml for standard usage.

    If you need to import this package specifically to access its iOS-specific APIs directly, you must add it to your pubspec.yaml manually.

  6. Install flutter_inappwebview_android

    master

    The flutter_inappwebview_android package is an endorsed federated plugin. For most users, you do not need to add it to your pubspec.yaml manually; it is automatically included when you add the main flutter_inappwebview package to your project.

    If you need to access Android-specific APIs directly via imports, you must add flutter_inappwebview_android to your pubspec.yaml as usual.

  7. Install the Flutter InAppWebView Plugin

    master

    To install the plugin, add flutter_inappwebview as a dependency in your pubspec.yaml file:

    dependencies:
      flutter_inappwebview: ^6.1.5

    Note: Specific platform setup (Android, iOS, macOS, Windows, Web) is required after adding the dependency. Refer to the official documentation for platform-specific configuration steps.

  8. Customize the iOS Launch Screen assets

    master

    To customize the launch screen for the iOS version of the example project, you can either replace the image files directly in the LaunchImage.imageset directory or use Xcode to manage the assets.

    To use Xcode:

    1. Open the iOS project using open ios/Runner.xcworkspace.
    2. In the Xcode Project Navigator, navigate to Runner/Assets.xcassets.
    3. Drag and drop your desired images into the asset catalog.
    open ios/Runner.xcworkspace