payment_webview 0.1.3 copy "payment_webview: ^0.1.3" to clipboard
payment_webview: ^0.1.3 copied to clipboard

A Flutter plugin for handling webviews with download and external app support. Supports file downloads, UPI payments, and external app launches.

Payment WebView #

A Flutter plugin for handling webviews with download and external app support. This plugin provides a simple way to integrate webviews into your Flutter app with support for file downloads, UPI payments, and external app launches.

Features #

  • πŸ”„ General webview functionality
  • πŸ“₯ File download support (PDF, DOC, XLS, ZIP, etc.)
  • πŸ’³ UPI payment handling
  • πŸ”— External app launching
  • ⚑ Loading state management
  • 🚫 Error handling
  • 🎨 Customizable loading widget

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  payment_webview: ^0.0.1

Usage #

import 'package:payment_webview/payment_webview.dart';

// Inside your widget
PaymentWebView(
  url: 'https://your-url.com',
  onError: (error) {
    print('Error: $error');
  },
  loadingWidget: CircularProgressIndicator(), // Optional custom loading widget
)

Features in Detail #

File Downloads #

The plugin automatically handles file downloads for common file types:

  • PDF (.pdf)
  • Word documents (.doc, .docx)
  • Excel spreadsheets (.xls, .xlsx)
  • Archives (.zip, .rar)
  • Any URL containing 'download'

Files are saved to:

  • Android: /storage/emulated/0/Download
  • iOS: Application Documents directory

UPI Payments #

UPI URLs are automatically detected and launched in the appropriate UPI app:

  • Supports upi:// scheme
  • Supports intent:// scheme for Android

External links are opened in the device's default browser or appropriate app.

Error Handling #

The plugin provides error handling through the onError callback:

PaymentWebView(
  url: 'https://your-url.com',
  onError: (error) {
    // Handle errors like:
    // - Storage permission denied
    // - Download failures
    // - Web resource errors
    print('Error: $error');
  },
)

Customization #

Loading Widget #

You can customize the loading indicator:

PaymentWebView(
  url: 'https://your-url.com',
  loadingWidget: Center(
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        CircularProgressIndicator(),
        SizedBox(height: 16),
        Text('Loading...'),
      ],
    ),
  ),
)

Platform Support #

  • Android
  • iOS

Requirements #

  • Flutter 3.0.0 or higher
  • Dart SDK 2.19.0 or higher

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

1
likes
140
points
50
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for handling webviews with download and external app support. Supports file downloads, UPI payments, and external app launches.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter, path_provider, permission_handler, url_launcher, webview_flutter

More

Packages that depend on payment_webview

Packages that implement payment_webview