-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat(mobile): adds crop and rotate to mobile #10989
feat(mobile): adds crop and rotate to mobile #10989
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool, thank you for your pull request! I was not aware of the crop_image package. I'm not super familiar with this package, so I'm not completely sure about how it works.
I'd prefer using the flutter_hooks
package just to remain consistent (although I've had my fair share of issues with it, in the past...)
I did not run this or test this.
Thank you @martyfuhry for the code suggestions, I will immediately make the necessary changes. Before I approve the code I would like to test them on my device, just to make sure everything works. Thanks for those suggestions again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not tremendously sure how to add an image to the server...
I think you need to actually add the image to your own gallery on your phone, first. Then, you can manually invoke the upload procedure on the new asset.
We use photo_manager for accessing the gallery. Try the PhotoManager.editor.saveImage
function? Maybe some others have a better idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments (even just one short sentence) above all of your classes to explain what they are for. Use the dart comments conventions.
It all looks good to me, otherwise! Please try saving the image to the gallery using the photo_manger package:
You can create an entity from raw data, such as downloaded images, recorded videos, etc. The created entity will show as a corresponding resource on your device's gallery app.
final Uint8List rawData = yourRawData;
// Save an image to an entity from `Uint8List`.
final AssetEntity? entity = await PhotoManager.editor.saveImage(
rawData,
title: 'write_your_own_title.jpg', // Affects EXIF reading.
);
We could also use the returned entity
to start a backup job immediately. Or we could do that in a future PR.
@martyfuhry does this now acceptable for merging? Keen to see such feature! |
This comment was marked as spam.
This comment was marked as spam.
Sorry lol, not sure because it's not in my hands now for merging. @martyfuhry is going to merge it soon 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry for my late reply! I had forgotten about the routing, it is a small change. I will test this out on my phone soon, too!
Thank you so much for your continued patience and hard work. We really appreciate your contribution, and I know this is a very valuable feature. I am looking forward to trying this out.
Hi @martyfuhry! Thanks for the suggestions, so firstly I cant replace the edit page and directly go to the crop page because of some logic in the edit page that helps the image load from the provider. The edit page is where the image is loaded from the server and displayed so removing it would mess some stuff up on the crop page. Below are the change made for my latest PR:
Let me know any changes, Thanks for reviewing! Hoping to get this pr out as soon as possible 😊 |
I suggest you simply trigger a scan of the local albums/assets after saving the edited image. This adds the new image to the timeline. To show it also in the gallery without reopening, look at what the delete button in the gallery does (it does some clearing/reset of the gallery state to refresh it from the timeline asset provider) |
Got it, will get that added to the PR tomorrow morning! |
Done! Just got everything cleaned up and fixed. Everything should work well and the timeline gets immediately updated when saving an edited image. I hope this is the final commit, that set don't hesitate to let me know any issues with my code. Once I get this basic edit layout stuff done, I could start working on the other features like filters and doodling! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is getting there!!!! One last request. When there is no edit made, can we hide the "Save to gallery" button"
Done! the button should be hidden until you make a change or use crop. |
congratulations! 😊 |
@Yuvi-raj-P many thanks for your work on this! |
Added an image editor and it has a crop feature only (for now)