super_webview 1.0.0
super_webview: ^1.0.0 copied to clipboard
A next-level, high-performance Flutter WebView plugin with advanced features like AI DOM automation, native ad blocking, dark mode, and seamless Flutter-JS integration.
SuperWebView 🚀 #
The most advanced, feature-rich, and performance-optimized WebView plugin for Flutter. Go beyond standard web views with powerful native integration, AI automation, and a pro-level developer experience.
🌟 Why SuperWebView? #
Standard WebViews in Flutter are often limited and hard to customize. super_webview is built from the ground up to be the ultimate replacement, offering "Pro" features out of the box that developers usually spend weeks implementing manually.
💎 Key Features #
- 🤖 AI-Powered DOM Automation: Interact with web elements using natural language (e.g.,
controller.ai.click("Login"))—no more fragile CSS selectors. - 🚀 Native-Level Ad Blocking: Block ads, trackers, and scripts at the engine level for faster loading and better privacy.
- 🌓 Forced Dark Mode: Intelligently force high-contrast dark themes on any website to match your app's theme.
- 📸 High-Res Screenshots: Capture current page states as PNG images programmatically with a single call.
- 🖨️ Native Print Support: One-click native system print dialog for receipts, tickets, and documents.
- 🔍 Find on Page: Built-in async text search within the loaded web content (Ctrl+F for mobile).
- 🍪 Pro Cookie Manager: Comprehensive handling of 3rd party cookies, session persistence, and SameSite policies.
- 🔄 Modern Lifecycle: Built-in Pull-to-Refresh, progress indicators, and crash recovery handlers.
- 🛡️ Advanced Security: SSL error handling, basic HTTP auth support, and deep-link interception.
- 📱 Desktop Mode: Instantly toggle between mobile and desktop user agents and viewports.
- ⌨️ Keyboard & Input Fixes: Optimized for hybrid composition and smooth text input.
📦 Installation #
Add this to your pubspec.yaml:
dependencies:
super_webview: ^1.0.0
Android Setup #
Ensure your minSdkVersion is at least 19 in android/app/build.gradle. For better performance and features like Dark Mode, Android 5.0+ (API 21) is recommended.
iOS Setup #
Add NSAppTransportSecurity and NSCameraUsageDescription / NSMicrophoneUsageDescription to your Info.plist if your web content requires them.
🚀 Quick Start #
import 'package:super_webview/super_webview.dart';
// ... inside your Widget build ...
SuperWebView(
initialUrl: 'https://flutter.dev',
allowPullToRefresh: true,
showProgressBar: true,
progressBarColor: Colors.blue,
onProgress: (progress) => print("Loading: $progress%"),
onPageFinished: (url) => print("Loaded: $url"),
)
🛠️ Advanced Usage #
1. Programmatic Control #
Use the SuperWebViewController to control every aspect of the WebView.
final controller = SuperWebViewController();
// Toggle Dark Mode
await controller.setDarkMode(true);
// Capture current page as bytes
final Uint8List? bytes = await controller.takeScreenshot();
// Switch to Desktop Version
await controller.setDesktopMode(true);
// Search for text
await controller.findAllAsync("Flutter");
2. AI DOM Automation ⭐ #
Interact with the page using semantic descriptions. Perfect for automation and testing.
// Locate and click a button labeled "Login" or "Sign In"
await controller.ai.click("Login");
// Find a field by label or placeholder and fill it
await controller.ai.fill("Email Address", "user@example.com");
3. Content Blocking (Ad Block) #
Block trackers and ads natively before they are even requested.
await controller.setContentBlockers([
ContentBlocker(
trigger: ContentBlockerTrigger(urlFilter: ".*doubleclick.net.*"),
action: ContentBlockerAction(type: ContentBlockerActionType.block),
),
ContentBlocker(
trigger: ContentBlockerTrigger(urlFilter: ".*google-analytics\\.com.*"),
action: ContentBlockerAction(type: ContentBlockerActionType.block),
),
]);
4. Navigation Interception #
Decide whether to allow or block specific navigation requests.
controller.setNavigationDelegate(NavigationDelegate(
onNavigationRequest: (request) {
if (request.url.contains("youtube.com")) {
return NavigationDecision.prevent; // Block YouTube
}
return NavigationDecision.navigate;
},
));
5. Cookie Management #
Persist sessions and handle logins with ease.
final cookieManager = SuperWebViewCookieManager();
await cookieManager.setCookie(
Uri.parse("https://example.com"),
"session_id=abc123; Domain=example.com; Path=/; Secure; HttpOnly",
);
await cookieManager.clearCookies();
🏗️ Platform Support #
| Feature | Android | iOS | Web |
|---|---|---|---|
| Basic Loading | ✅ | ✅ | ✅ |
| JS Execution | ✅ | ✅ | ✅ |
| Ad Blocking | ✅ | ✅ | ❌ |
| Dark Mode | ✅ | ✅ | ❌ |
| Screenshots | ✅ | ✅ | ❌ |
| Print Support | ✅ | ✅ | ✅ |
| AI Automation | ✅ | ✅ | ✅ |
| Cookies | ✅ | ✅ | ✅ |
🤝 Contributing #
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License #
Distributed under the MIT License. See LICENSE for more information.