๐ HyperRender Clipboard
Full-featured image clipboard operations for 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 ClipboardCopy actual image data to clipboard, not just URLs. Works across all platforms with proper image format support.
|
๐พ Smart SavingSave images to device-appropriate locations automatically. No manual path handling needed.
|
๐ Native SharingOpen system share dialogs with zero configuration. Works with all platform share targets.
|
๐จ 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.
๐ก 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.')),
);
}
๐ 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:
super_clipboard^0.8.0 - Cross-platform clipboardhttp^1.2.0 - Image downloadingpath_provider^2.1.0 - Platform pathsshare_plus^7.2.0 - Native sharing
๐ค Contributing
Contributions are welcome! Here's how you can help:
- ๐ Report bugs - Found an issue? Open an issue
- ๐ก Suggest features - Have an idea? We'd love to hear it!
- ๐ง Submit PRs - Read our contributing guidelines
- ๐ Improve docs - Help others understand better
- โญ Star the repo - Show your support!
๐ฆ Related Packages
Part of the HyperRender ecosystem:
- hyper_render - Main package for HTML/Markdown rendering
- hyper_render_core - Core interfaces and widgets
- hyper_render_clipboard - This package (Image operations)
๐ License
MIT License - see LICENSE file for details.
Made with โค๏ธ for the Flutter community
Libraries
- hyper_render_clipboard
- HyperRender Clipboard - Image clipboard support for HyperRender