-
Notifications
You must be signed in to change notification settings - Fork 131
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
Conversation
Hi @ruerob, To which package did you add this functionality? flutter_image_editor hasn't been updated since 2019. |
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. |
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 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); |
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.
ScaleOption(width,height,keepRatio: keepRatio); | |
ScaleOption(width, height, keepRatio: keepRatio); |
var w = option.width | ||
var h = option.height | ||
|
||
if(option.keepRatio) { |
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.
if(option.keepRatio) { | |
if (option.keepRatio) { |
data class ScaleOption(val width: Int, val height: Int, val keepRatio: Boolean) : Option |
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.
We need a proper EOF here.
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.
Then we should add a new line, correct?
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.
Yes, in the local file.
ios/Classes/FIUIImageHandler.m
Outdated
if(option.keepRatio){ | ||
if(imageRatio < optionRatio){ | ||
w = option.height * imageRatio; | ||
}else if(imageRatio > optionRatio){ | ||
h = option.width / imageRatio; | ||
} | ||
} |
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.
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; | |
} | |
} |
lib/src/option/scale.dart
Outdated
ScaleOption(this.width, this.height, {this.keepRatio: false}) | ||
: assert(width > 0), | ||
assert(height > 0); |
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.
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); |
@ruerob Hi, are you still on this track? |
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. |
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