Skip to content

Commit

Permalink
update image_cropper 5.0.1 to 8.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MayankJha014 committed Sep 13, 2024
1 parent d88de31 commit 23912bd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 48 deletions.
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
url: "https://pub.dev"
source: hosted
version: "0.19.0"
version: "0.18.1"
io:
dependency: transitive
description:
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dependencies:
http: ^1.2.1
image_cropper: ^8.0.2
image_picker: ^1.1.1
intl: ^0.19.0
intl: ^0.18.1
json_annotation: ^4.7.0
mockito: ^5.4.4
network_image_mock: ^2.1.1
Expand Down Expand Up @@ -93,6 +93,9 @@ dev_dependencies:

url_launcher_platform_interface: 2.3.2

dependency_overrides:
intl: ^0.18.1

flutter:
uses-material-design: true
assets:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@



# cropImage method








[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[File](https://api.flutter.dev/flutter/dart-io/File-class.html)?> cropImage
({required [File](https://api.flutter.dev/flutter/dart-io/File-class.html) imageFile})





<p>This function is used to crop the image selected by the user.</p>
<p>The function accepts a <code>File</code> type image and returns <code>File</code> type of cropped image.</p>
<p><strong>params</strong>:</p>
Expand All @@ -28,8 +14,6 @@
<li><code>Future&lt;File?&gt;</code>: the image after been cropped.</li>
</ul>



## Implementation

```dart
Expand All @@ -38,10 +22,6 @@ Future<File?> cropImage({required File imageFile}) async {
try {
final CroppedFile? croppedImage = await locator<ImageCropper>().cropImage(
sourcePath: imageFile.path,
aspectRatioPresets: [
CropAspectRatioPreset.square,
CropAspectRatioPreset.original,
],
uiSettings: [
AndroidUiSettings(
toolbarTitle: 'Crop Image',
Expand All @@ -51,6 +31,10 @@ Future<File?> cropImage({required File imageFile}) async {
cropGridColor: Colors.white,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false,
aspectRatioPresets: [
CropAspectRatioPreset.square,
CropAspectRatioPreset.original,
],
),
IOSUiSettings(
minimumAspectRatio: 1.0,
Expand All @@ -68,10 +52,3 @@ Future<File?> cropImage({required File imageFile}) async {
return null;
}
```







2 changes: 0 additions & 2 deletions test/helpers/test_helpers.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4203,8 +4203,6 @@ class MockImageCropper extends _i2.Mock implements _i39.ImageCropper {
#maxWidth: maxWidth,
#maxHeight: maxHeight,
#aspectRatio: aspectRatio,
#aspectRatioPresets: aspectRatioPresets,
#cropStyle: cropStyle,
#compressFormat: compressFormat,
#compressQuality: compressQuality,
#uiSettings: uiSettings,
Expand Down
8 changes: 0 additions & 8 deletions test/service_tests/image_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ void main() {
when(
mockImageCropper.cropImage(
sourcePath: "test",
// aspectRatioPresets: [
// CropAspectRatioPreset.square,
// CropAspectRatioPreset.original,
// ],
uiSettings: anyNamed('uiSettings'),
),
).thenAnswer((realInvocation) async => croppedFile);
Expand All @@ -63,10 +59,6 @@ void main() {
when(
mockImageCropper.cropImage(
sourcePath: "test",
// aspectRatioPresets: [
// CropAspectRatioPreset.square,
// CropAspectRatioPreset.original,
// ],
uiSettings: anyNamed('uiSettings'),
),
).thenThrow(Exception());
Expand Down
8 changes: 0 additions & 8 deletions test/service_tests/multi_media_pick_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ void main() {
when(
mockImageCropper.cropImage(
sourcePath: "test",
// aspectRatioPresets: [
// CropAspectRatioPreset.square,
// CropAspectRatioPreset.original,
// ],
uiSettings: anyNamed('uiSettings'),
),
).thenAnswer((realInvocation) async => CroppedFile(path));
Expand All @@ -65,10 +61,6 @@ void main() {
when(
mockImageCropper.cropImage(
sourcePath: "test",
// aspectRatioPresets: [
// CropAspectRatioPreset.square,
// CropAspectRatioPreset.original,
// ],
uiSettings: anyNamed('uiSettings'),
),
).thenAnswer((realInvocation) async => CroppedFile(path));
Expand Down

0 comments on commit 23912bd

Please sign in to comment.