hyper_render_clipboard 1.0.3 copy "hyper_render_clipboard: ^1.0.3" to clipboard
hyper_render_clipboard: ^1.0.3 copied to clipboard

Image clipboard support for HyperRender using super_clipboard. Enables copying, saving, and sharing images.

πŸ“‹ 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 #

  • πŸ“– API Reference Complete API with examples

  • 🎯 Usage Guide Patterns and best practices

  • πŸ”§ Platform Setup Configuration for each platform

πŸ†˜ Getting Help #

  • πŸ› Troubleshooting Common issues and solutions

  • πŸ“‹ Documentation Index Complete documentation overview

  • πŸ’¬ GitHub Issues Report bugs or request features


🎨 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

6
likes
0
points
189
downloads

Publisher

verified publisherbrewkits.dev

Weekly Downloads

Image clipboard support for HyperRender using super_clipboard. Enables copying, saving, and sharing images.

Homepage
Repository (GitHub)
View/report issues

Topics

#flutter #clipboard #image-copy

License

unknown (license)

Dependencies

flutter, http, hyper_render_core, path_provider, share_plus, super_clipboard

More

Packages that depend on hyper_render_clipboard