image_clipboard 1.1.0+1 image_clipboard: ^1.1.0+1 copied to clipboard
A Flutter plugin for copying and reading images to the clipboard on Web, Windows, and macOS platforms.
image_clipboard #
A Flutter plugin for copying and reading images to the clipboard on Web, Windows, and macOS platforms.
This plugin was initially developed by the Tencent Cloud Chat Flutter team for use in the Tencent Cloud Chat Flutter TUIKit chat component library and is now available for everyone to use.
Usage #
To use this plugin, add image_clipboard
as a dependency in your pubspec.yaml file.
Example #
import 'package:flutter/material.dart';
import 'package:image_clipboard/image_clipboard.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Image Clipboard Example')),
body: Center(child: CopyImageButton()),
),
);
}
}
class CopyImageButton extends StatelessWidget {
final imageClipboard = ImageClipboard();
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: () async {
final imagePath = 'path/to/your/image'; // Replace with your image path or URL
await imageClipboard.copyImage(imagePath);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Image copied to clipboard')),
);
},
child: Text('Copy Image'),
);
}
}
Supported Platforms #
- Web
- Windows
- macOS
Please note that this plugin does not currently support Android, iOS, or Linux platforms.
Contributing #
Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub.
License #
This plugin is available under the MIT License.