Flutter Simple WebView (Smart Edition) ๐Ÿš€

Banner

A production-ready, ultra-lightweight, and feature-rich WebView for Flutter. Designed to handle the "hard stuff" like File Uploads, Authenticated Downloads, Permission Management, and Deep Linking automatically.


โœจ Features

  • ๏ฟฝ Native File Picker: Full support for <input type="file"> on Android and iOS (Camera, Gallery, Files).
  • โฌ‡๏ธ Smart Downloads: Intercepts downloadable links (.pdf, .zip, .png, etc.) and handles them via a background manager.
  • ๐Ÿช Cookie Persistence: Built-in cookie management for seamless Odoo, SAP, or ERP sessions.
  • ๐Ÿ“ก Zero-Dependency Connectivity: Uses raw dart:io logic to detect internet status without bloating your bundle.
  • ๐Ÿ”’ Auto-Permissions: Requests Camera, Microphone, and Storage permissions only when needed.
  • ๐Ÿ”— Deep Link Handler: Supports tel:, mailto:, whatsapp:, and custom external schemes.
  • ๐ŸŽจ Fully Customizable: Control every aspect of the UI (AppBar, Colors, Progress Indicator).
  • ๐ŸŒ‰ JS Bridge: Simple bi-directional communication between Flutter and JavaScript.
  • ๐Ÿ›ก๏ธ Error Handling: Beautiful built-in Offline and Error screens.

๐Ÿ“ฆ Installation

Add this to your pubspec.yaml:

dependencies:
  flutter_simple_webview: ^1.0.0

๐Ÿ› ๏ธ Platform Setup

Android

Add permissions to android/app/src/main/AndroidManifest.xml:

<manifest ...>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
</manifest>

iOS

Add these keys to ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>We need camera access to upload photos from the webview.</string>
<key>NSMicrophoneUsageDescription</key>
<string>We need microphone access for audio recording.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access to your photos to allow file uploads.</string>

๐Ÿš€ Usage

1. Basic Usage

The simplest way to get up and running.

import 'package:flutter_simple_webview/flutter_simple_webview.dart';

class MyPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const FlutterSimpleWebView(
      url: 'https://flutter.dev',
      title: 'Flutter Website',
    );
  }
}

2. Advanced / ERP Configuration

Perfect for Odoo or custom enterprise apps requiring session management.

FlutterSimpleWebView(
  url: 'https://my-odoo-erp.com',
  title: 'Company Portal',
  showAppBar: true, 
  appBarColor: Colors.indigo,
  accentColor: Colors.orange,
  enableJsBridge: true,
  onJsMessage: (name, data) {
    print("JS Event: $name, Data: $data");
  },
  initialCookies: [
    Cookie('session_id', 'xyz123')
      ..domain = 'my-odoo-erp.com'
  ],
)

๐Ÿ“– API Reference

Parameter Type Default Description
url String Required The target website URL to load.
title String? "WebView" The text displayed in the AppBar.
showAppBar bool true Whether to show the standard Scaffold AppBar.
appBarColor Color? Theme primary Background color for the AppBar.
accentColor Color? Theme accent Color for the progress bar and buttons.
headers Map? null Custom HTTP headers for the initial request.
enableJsBridge bool false Enable FlutterBridge JS channel.
initialCookies List<Cookie>? null Pre-set cookies before loading the URL.

๐Ÿง  How It Works

Connectivity Management

Unlike many packages that rely on heavy plugins, this package uses a raw internet probe (InternetAddress.lookup). It detects true internet access (not just Wi-Fi connection) and handles offline states with a polished UI.

File Handling

  • Uploads: Automatically triggers the native OS file picker when the WebView requests a file selector.
  • Downloads: Intercepts URLs with common file extensions. It preserves session cookies to ensure you can download files from password-protected ERP sections.

๐Ÿค Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to help make this package even better.


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details. Designed with โค๏ธ for the Flutter community.

๐Ÿง‘โ€๐Ÿ’ป Developer / เฆกเง‡เฆญเง‡เฆฒเฆชเฆพเฆฐ

Md. Rahul Reza GitHub | LinkedIn | Website