-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2️⃣6️⃣ allow the user to be able to past an image into the bug report page in the app #231
Comments
Regarding this, I did some research but could not find anything for android. Therefore, 12 days ago I started a thread on Stack Overflow, but it went unanswered. I have now started a bounty on that thread, hopefully we will get something now - https://stackoverflow.com/questions/75658357/how-to-accept-images-in-textfield-flutter |
Please excuse the un formatted AI responseCurrently, Flutter's TextField widget does not have built-in support for pasting images directly from the clipboard. However, you can achieve this functionality by implementing a workaround using a combination of platform channels and a third-party package. Here's a step-by-step guide to implementing this feature: Create a MethodChannel to communicate with native Android code: dart const platform = const MethodChannel('com.example.app/image_paste'); Implement the native Android code for accessing clipboard images: kotlin import android.content.ClipData class MainActivity : FlutterActivity() {
} Handle pasting images in Flutter: dart // ... Future<Uint8List?> _getImageFromClipboard() async { // ... ElevatedButton( // ... _image, // display the pasted image This implementation allows you to paste images from the clipboard into your Flutter app |
This is interesting, let me give it a shot! |
@fredfalcon It doesn't work, |
You could try giving the error and code to ChatGPT4 and work it out. I'm rate limited currently |
Related to #231 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/OWASP-BLT/BLT-Flutter/issues/231?shareId=XXXX-XXXX-XXXX-XXXX).
Is this issue resolved? |
It’s not resolved yet |
/assign |
Hello @krrish-sehgal! You've been assigned to OWASP-BLT/BLT-Flutter. You have 24 hours to complete a pull request. To place a bid and potentially earn some BCH, type /bid [amount in BCH] [BCH address]. |
Just to clarify, when implementing the image-pasting option in the description text box, should the pasted image be displayed at the bottom of the description (similar to adding an image through the "Add Image" button), or should it appear at the top of the description box, like in GPT's text field? |
@letsintegreat , I was able to do it using the approach mentioned by @fredfalcon, with changes that deemed necessary. Thanks. |
Need custom function for copying image from clipboard as Pasteboard package does not supports android platform
to get this functionality switch to the flutter master channel (command flutter channel master), this will now include PR 110052 which adds this functionality.
to use it simply add this to your TextField:
//...
contentInsertionConfiguration: ContentInsertionConfiguration(
onContentInserted : (_){/your cb here/}
allowedMimeTypes: ["image/png",/.../],
}),
//...
this will then use the android specific content commit api to (as you guessed) tell the OS that your TextField accepts the given mimetypes; gboard will recognize this and suggest the content with fitting mimetypes in your clipboard
The text was updated successfully, but these errors were encountered: