Skip to content
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

- Fixes scaling on android and added aspect ratio #70

Merged
merged 4 commits into from
Jul 11, 2022

Conversation

ruerob
Copy link
Contributor

@ruerob ruerob commented Aug 27, 2021

Hello there!

I needed the option to keep the aspect ratio of the original image while scaling. I added this functionality to Android and iOS, I also tested it on my devices and hope it helps you as it helps me.
Also, this fixes issue 65 (#65) which prevents the pictures from being scaled to bigger sizes on Android.

Best wishes,
ruerob

@guihackmann
Copy link

Hi @ruerob,

To which package did you add this functionality? flutter_image_editor hasn't been updated since 2019.

@ruerob
Copy link
Contributor Author

ruerob commented Sep 6, 2021

Hi @guihackmann!

When I look into the commits at https://github.com/fluttercandies/flutter_image_editor/commits/master, the last update was on May 6, 2021. My change isn't approved by now, so it is not merged into the master branch.

One of the maintainers has to take a look into my changes and has to approve them in order to add the functionality into the master branch of this project.

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good overall, but since the plugin is related to image editing, can you provide some screenshots about the difference before and after this change when editing?

README.md Outdated
@@ -154,10 +154,10 @@ p, q, r, s, t
#### Scale

```dart
ScaleOption(width,height);
ScaleOption(width,height,keepRatio: keepRatio);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ScaleOption(width,height,keepRatio: keepRatio);
ScaleOption(width, height, keepRatio: keepRatio);

var w = option.width
var h = option.height

if(option.keepRatio) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(option.keepRatio) {
if (option.keepRatio) {

data class ScaleOption(val width: Int, val height: Int, val keepRatio: Boolean) : Option
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a proper EOF here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we should add a new line, correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the local file.

Comment on lines 256 to 262
if(option.keepRatio){
if(imageRatio < optionRatio){
w = option.height * imageRatio;
}else if(imageRatio > optionRatio){
h = option.width / imageRatio;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(option.keepRatio){
if(imageRatio < optionRatio){
w = option.height * imageRatio;
}else if(imageRatio > optionRatio){
h = option.width / imageRatio;
}
}
if (option.keepRatio) {
if (imageRatio < optionRatio) {
w = option.height * imageRatio;
} else if (imageRatio > optionRatio) {
h = option.width / imageRatio;
}
}

Comment on lines 8 to 10
ScaleOption(this.width, this.height, {this.keepRatio: false})
: assert(width > 0),
assert(height > 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ScaleOption(this.width, this.height, {this.keepRatio: false})
: assert(width > 0),
assert(height > 0);
ScaleOption(
this.width,
this.height, {
this.keepRatio: false,
}) : assert(width > 0 && height > 0);

@AlexV525
Copy link
Member

@ruerob Hi, are you still on this track?

@ruerob
Copy link
Contributor Author

ruerob commented May 12, 2022

Sorry for the long wait. I'm currently no longer on the flutter track. I haven't even installed Android Studio on my device.

@AlexV525
Copy link
Member

Sorry for the long wait. I'm currently no longer on the flutter track. I haven't even installed Android Studio on my device.

Thanks for let us know.

@AlexV525 AlexV525 merged commit 32149c2 into fluttercandies:master Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants