flutter_simple_webview 2.0.0
flutter_simple_webview: ^2.0.0 copied to clipboard
A production-grade, zero-dependency Flutter WebView package with advanced features like file upload, background download, and cookie persistence.
Flutter Simple WebView #
A production-grade, zero-dependency Flutter WebView package designed for enterprise applications.
Designed for ERP systems, Odoo, SAP, and high-security fintech apps.
🚀 Features #
- Zero Dependencies: Built purely on Flutter SDK, Kotlin, and Swift.
- Native File Upload: Full support for
<input type="file">(Camera, Gallery, Multiple files). - Background Downloads: Smart download manager for PDF, ZIP, Images, etc. using native
DownloadManager(Android) andURLSession(iOS). - Enterprise Cookies: Persistent cookie storage synced with native
CookieManager. - Zero-Dep Connectivity: Built-in connection detection using
InternetAddress.lookup. - Intelligent Permissions: Requests permissions (Camera, Mic, Storage) only when needed (Runtime permissions handled).
- Deep Linking: Handles
tel:,mailto:,whatsapp:, and custom schemes automatically. - Secure JS Bridge: Safe 2-way communication between Dart and JavaScript.
- Customizable UI: Built-in progress bar, error screens, and offline mode.
📦 Installation #
Add this to your pubspec.yaml:
dependencies:
flutter_simple_webview: ^2.0.0
🛠 Usage #
Basic Usage #
import 'package:flutter_simple_webview/flutter_simple_webview.dart';
SimpleWebView(
url: "https://flutter.dev",
)
Advanced Usage #
import 'package:flutter_simple_webview/flutter_simple_webview.dart';
SimpleWebView(
url: "https://example.com",
showAppBar: true,
appBarColor: Colors.deepPurple,
progressColor: Colors.orange,
onWebViewCreated: (controller) {
// Control the webview programmatically
controller.loadUrl("https://google.com");
},
onConnectivityChanged: (connected) {
print("Is Connected: $connected");
},
onMessageReceived: (message) {
print("JS Message: $message");
},
)
📱 Platform Setup #
Android #
- Internet Permission: Ensure you have internet permission in
android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
- File Uploads/Downloads: No extra setup required! The package handles
READ_EXTERNAL_STORAGE,CAMERA, andRECORD_AUDIOpermissions at runtime when the specific web feature requests it.
iOS #
Add the following keys to your ios/Runner/Info.plist for file upload support (Camera/Gallery):
<key>NSCameraUsageDescription</key>
<string>We need access to camera for file uploads.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access to photos for file uploads.</string>
<key>NSMicrophoneUsageDescription</key>
<string>We need access to microphone for audio recording.</string>
🔧 API Reference #
SimpleWebView #
| Property | Type | Description |
|---|---|---|
url |
String |
The initial URL to load. |
showAppBar |
bool |
Toggle the built-in AppBar. |
appBarColor |
Color? |
Custom color for the AppBar. |
progressColor |
Color? |
Custom color for the loading indicator. |
enablePullToRefresh |
bool |
Enable/Disable pull-to-refresh. |
onConnectivityChanged |
Function(bool)? |
Callback for network status changes. |
onMessageReceived |
Function(String)? |
Callback for JS messages. |
WebViewController #
| Method | Description |
|---|---|
loadUrl(String url) |
Loads a new URL. |
reload() |
Reloads the current page. |
goBack() |
Navigates back. |
goForward() |
Navigates forward. |
runJavaScript(String script) |
Runs arbitrary JS. |
📄 License #
MIT License. See LICENSE file.
Designed with ❤️ for the Flutter community.