Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harshilchovatiya/image_to_clipboard
ImageToClipboard is a simple and efficient plugin designed to facilitate the copying of images to the clipboard in Flutter applications. This plugin is currently supported on Android.
https://github.com/harshilchovatiya/image_to_clipboard
android-development clipboard copy-to copy-to-clipboard flutter flutter-packages flutter-plugin flutter-plugins image-clipboard image-handling image-sharing image-to-clipboard mobile-development
Last synced: 4 days ago
JSON representation
ImageToClipboard is a simple and efficient plugin designed to facilitate the copying of images to the clipboard in Flutter applications. This plugin is currently supported on Android.
- Host: GitHub
- URL: https://github.com/harshilchovatiya/image_to_clipboard
- Owner: harshilchovatiya
- License: mit
- Created: 2024-07-29T09:05:07.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-29T09:49:48.000Z (5 months ago)
- Last Synced: 2024-10-31T08:43:01.877Z (about 2 months ago)
- Topics: android-development, clipboard, copy-to, copy-to-clipboard, flutter, flutter-packages, flutter-plugin, flutter-plugins, image-clipboard, image-handling, image-sharing, image-to-clipboard, mobile-development
- Language: Dart
- Homepage: https://pub.dev/packages/image_to_clipboard
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ImageToClipboard
A Flutter plugin to copy images to the clipboard on Android. This plugin allows you to easily copy image files to the clipboard, enabling quick and convenient image sharing within your Flutter apps.
## Description
`ImageToClipboard` is a simple and efficient plugin designed to facilitate the copying of images to the clipboard in Flutter applications. This plugin is currently supported on Android.
## Features
- Copy any image file to the clipboard.
- Easy to integrate with your existing Flutter projects.
- Handles file permissions and URI exposure securely.## Getting Started
To use this plugin, follow the steps below:
### 1. Add Dependency
Add the following dependency to your `pubspec.yaml` file:
```yaml
dependencies:
image_to_clipboard: ^0.0.1
```### 2. Android Setup
In your Android project, you need to update the `AndroidManifest.xml` and provide a file provider path configuration.
#### Update `AndroidManifest.xml`
Add the following inside the `` tag:
```xml
```
#### Create `file_paths.xml`
Create a new XML file named `file_paths.xml` in `android/app/src/main/res/xml/` directory with the following content:
```xml
```
### 3. Request Permissions
Ensure you request the necessary storage permissions in your app. You can use the `permission_handler` package for this purpose.
Add the following permissions to your `AndroidManifest.xml`:
```xml
```
## Usage
Here’s a simple example of how to use the `ImageToClipboard` plugin:
```dart
import 'package:flutter/material.dart';
import 'package:image_to_clipboard/image_to_clipboard.dart';void main() {
runApp(MyApp());
}class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ClipboardExample(),
);
}
}class ClipboardExample extends StatefulWidget {
@override
_ClipboardExampleState createState() => _ClipboardExampleState();
}class _ClipboardExampleState extends State {
String _status = 'Idle';Future _copyImage(String path) async {
String? result = await ImageToClipboard.copyImageToClipboard(path);
setState(() {
_status = result ?? 'Failed to copy image';
});
}@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Clipboard Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Status: $_status'),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Replace with the actual path of your image file
String imagePath = '/path/to/your/image.png';
_copyImage(imagePath);
},
child: Text('Copy Image to Clipboard'),
),
],
),
),
);
}
}
```## Additional Information
- **Platform Support**: Currently, this plugin supports only Android. iOS support will be added in future releases.
- **Permissions**: Ensure that the necessary storage permissions are granted for the plugin to function correctly.
- **Documentation**: For detailed documentation, refer to the [package documentation](https://pub.dev/packages/image_to_clipboard).
- **Contributing**: Contributions are welcome! Please check the [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute.
- **Issues**: If you encounter any issues, please file them on the [issue tracker](https://github.com/harshilchovatiya/image_to_clipboard/issues).For more detailed information and updates, visit the [GitHub repository](https://github.com/harshilchovatiya/image_to_clipboard).
---
By following the instructions and example provided, you can easily integrate the `ImageToClipboard` plugin into your Flutter applications and enable image copying to the clipboard on Android devices.