๐Ÿ“‹ HyperRender Clipboard

Full-featured image clipboard operations for Flutter

pub package License: MIT Flutter

Copy, save, and share images with just one line of code

Features โ€ข Quick Start โ€ข Platform Support โ€ข Documentation โ€ข Examples


๐ŸŽฏ What is HyperRender Clipboard?

A powerful, easy-to-use Flutter package that enables real image clipboard operations (not just URLs!) across all platforms. Built on top of super_clipboard, it integrates seamlessly with HyperRender and can be used standalone in any Flutter app.

Why Choose HyperRender Clipboard?

โŒ Without โœ… With HyperRender Clipboard
Only copy image URLs Copy actual image data to clipboard
Manual file operations One-line save to device storage
Custom share dialogs Native system share on all platforms
Platform-specific code Write once, works everywhere

โœจ Features

๐Ÿ“‹ Real Clipboard

Copy actual image data to clipboard, not just URLs. Works across all platforms with proper image format support.

  • PNG, JPEG, GIF, WebP, BMP, TIFF
  • URL or raw bytes
  • Platform-native behavior

๐Ÿ’พ Smart Saving

Save images to device-appropriate locations automatically. No manual path handling needed.

  • Auto location detection
  • Custom filenames
  • Format auto-detection
  • Scoped storage support

๐Ÿ”— Native Sharing

Open system share dialogs with zero configuration. Works with all platform share targets.

  • Native UI/UX
  • Custom captions
  • All share targets
  • Platform-optimized

๐ŸŽจ Additional Capabilities

  • ๐Ÿš€ Zero Config - Works with HyperViewer out of the box
  • ๐Ÿ”ง Flexible - Use standalone or integrated
  • โšก Fast - Optimized for performance
  • ๐Ÿงช Type-Safe - Full Dart type safety
  • ๐Ÿ“ฑ Cross-Platform - Desktop, mobile, and web
  • ๐Ÿ›ก๏ธ Production Ready - Battle-tested in production apps

๐Ÿš€ Quick Start

Installation

Add to your pubspec.yaml:

dependencies:
  hyper_render_clipboard: ^1.0.0

Run:

flutter pub get

Usage (3 Lines!)

import 'package:hyper_render_clipboard/hyper_render_clipboard.dart';

// That's it! ๐ŸŽ‰
HyperViewer(
  html: '<img src="https://example.com/image.png">',
  imageClipboardHandler: SuperClipboardHandler(),
)

Users can now long-press any image to:

  • ๐Ÿ“‹ Copy to clipboard
  • ๐Ÿ’พ Save to device
  • ๐Ÿ”— Share via system dialog

Standalone Usage

final handler = SuperClipboardHandler();

// Copy image ๐Ÿ“‹
await handler.copyImageFromUrl('https://example.com/photo.jpg');

// Save image ๐Ÿ’พ
final path = await handler.saveImageFromUrl(
  'https://example.com/photo.jpg',
  filename: 'my_photo.jpg',
);

// Share image ๐Ÿ”—
await handler.shareImageFromUrl(
  'https://example.com/photo.jpg',
  text: 'Check this out!',
);

๐ŸŽจ Platform Support

Platform Copy Save Share Setup Required
๐ŸŽ macOS โœ… โœ… โœ… Network entitlement
๐ŸชŸ Windows โœ… โœ… โœ… None โญ
๐Ÿง Linux โœ… โœ… โœ… Install xclip
๐Ÿ“ฑ iOS โœ… โœ… โœ… ATS config
๐Ÿค– Android โœ… โœ… โœ… Internet permission
๐ŸŒ Web โš ๏ธ โŒ โœ… HTTPS + CORS

Legend: โœ… Full Support โ€ข โš ๏ธ Limited โ€ข โŒ Not Available

๐Ÿ“– Platform Setup Details

macOS

<!-- Add to both DebugProfile.entitlements and Release.entitlements -->
<key>com.apple.security.network.client</key>
<true/>

iOS

<!-- Add to Info.plist -->
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Android

<!-- Add to AndroidManifest.xml -->
<uses-permission android:name="android.permission.INTERNET"/>

Linux

# Install xclip
sudo apt-get install xclip  # Ubuntu/Debian
sudo dnf install xclip      # Fedora
sudo pacman -S xclip        # Arch

Windows

No setup required! ๐ŸŽ‰

Web

Ensure HTTPS and proper CORS headers.

๐Ÿ“š Complete Platform Setup Guide โ†’


๐Ÿ’ก Examples

Work with Image Bytes

Perfect for screenshots, generated images, or canvas exports:

import 'dart:typed_data';

final Uint8List imageBytes = ...; // Your image data

// Copy screenshot to clipboard
await handler.copyImageBytes(imageBytes, mimeType: 'image/png');

// Save generated image
final path = await handler.saveImageBytes(
  imageBytes,
  filename: 'artwork_${DateTime.now()}.png',
);

// Share canvas export
await handler.shareImageBytes(
  imageBytes,
  text: 'Created with MyApp!',
  filename: 'drawing.png',
);

Custom Context Menu

HyperViewer(
  html: content,
  imageClipboardHandler: SuperClipboardHandler(),
  onImageLongPress: (imageUrl, handler) {
    showModalBottomSheet(
      context: context,
      builder: (context) => Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          ListTile(
            leading: Icon(Icons.copy),
            title: Text('Copy Image'),
            onTap: () => handler.copyImageFromUrl(imageUrl),
          ),
          ListTile(
            leading: Icon(Icons.save),
            title: Text('Save Image'),
            onTap: () => handler.saveImageFromUrl(imageUrl),
          ),
          ListTile(
            leading: Icon(Icons.share),
            title: Text('Share Image'),
            onTap: () => handler.shareImageFromUrl(imageUrl),
          ),
        ],
      ),
    );
  },
)

Platform Detection

final handler = SuperClipboardHandler();

// Check what's supported
if (handler.isImageCopySupported) {
  await handler.copyImageFromUrl(imageUrl);
} else if (handler.isShareSupported) {
  // Fallback to share on platforms with limited clipboard
  await handler.shareImageFromUrl(imageUrl);
}

// Check supported formats
print(handler.supportedFormats);
// [image/png, image/jpeg, image/gif, image/webp, image/bmp]

Error Handling

final success = await handler.copyImageFromUrl(imageUrl);

if (success) {
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(content: Text('โœ… Image copied!')),
  );
} else {
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(content: Text('โŒ Failed to copy. Check your network.')),
  );
}

๐ŸŽฏ More Examples โ†’


๐Ÿ“š Documentation

๐Ÿ“˜ For Developers

๐Ÿ†˜ Getting Help


๐ŸŽจ Supported Image Formats

Format MIME Type Copy Save Share
PNG image/png โœ… โœ… โœ…
JPEG image/jpeg โœ… โœ… โœ…
GIF image/gif โœ… โœ… โœ…
WebP image/webp โœ… โœ… โœ…
BMP image/bmp โœ… โœ… โœ…
TIFF image/tiff โœ… โœ… โœ…

๐Ÿ—๏ธ Architecture

This package implements the ImageClipboardHandler interface from hyper_render_core:

abstract class ImageClipboardHandler {
  // Operations
  Future<bool> copyImageFromUrl(String imageUrl);
  Future<bool> copyImageBytes(Uint8List bytes, {String? mimeType});
  Future<String?> saveImageFromUrl(String imageUrl, {String? filename});
  Future<String?> saveImageBytes(Uint8List bytes, {String? filename});
  Future<bool> shareImageFromUrl(String imageUrl, {String? text});
  Future<bool> shareImageBytes(Uint8List bytes, {String? text, String? filename});

  // Platform capabilities
  bool get isImageCopySupported;
  bool get isSaveSupported;
  bool get isShareSupported;
  List<String> get supportedFormats;
}

Default vs SuperClipboard

Feature DefaultImageClipboardHandler SuperClipboardHandler โญ
Copy Method URL only Actual image data
Formats Any URL PNG, JPEG, GIF, WebP, BMP, TIFF
Platforms All Desktop, Mobile, Web (limited)
Setup Required None Minimal platform config

๐Ÿ”— Dependencies

Built on top of these excellent packages:


๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. ๐Ÿ› Report bugs - Found an issue? Open an issue
  2. ๐Ÿ’ก Suggest features - Have an idea? We'd love to hear it!
  3. ๐Ÿ”ง Submit PRs - Read our contributing guidelines
  4. ๐Ÿ“– Improve docs - Help others understand better
  5. โญ Star the repo - Show your support!

Part of the HyperRender ecosystem:


๐Ÿ“„ License

MIT License - see LICENSE file for details.



Made with โค๏ธ for the Flutter community

โฌ† Back to Top

Libraries

hyper_render_clipboard
HyperRender Clipboard - Image clipboard support for HyperRender