Skip to content

Commit

Permalink
fix: update image cropper to 2.0.0 #1672 (#1695)
Browse files Browse the repository at this point in the history
* updated image cropper to 2.0.0

* remove ignore type
  • Loading branch information
AshAman999 authored Apr 29, 2022
1 parent af7ce55 commit bd10bbb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
33 changes: 18 additions & 15 deletions packages/smooth_app/lib/pages/image_crop_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_cropper_platform_interface/image_cropper_platform_interface.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/themes/theme_provider.dart';
Expand All @@ -23,7 +24,7 @@ Future<File?> startImageCropping(BuildContext context) async {

final AppLocalizations appLocalizations = AppLocalizations.of(context)!;

final File? croppedFile = await ImageCropper().cropImage(
final CroppedFile? croppedFile = await ImageCropper().cropImage(
sourcePath: pickedXFile.path,
aspectRatioPresets: <CropAspectRatioPreset>[
CropAspectRatioPreset.square,
Expand All @@ -32,19 +33,21 @@ Future<File?> startImageCropping(BuildContext context) async {
CropAspectRatioPreset.ratio4x3,
CropAspectRatioPreset.ratio16x9
],
androidUiSettings: AndroidUiSettings(
toolbarTitle: appLocalizations.product_edit_photo_title,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false,
statusBarColor: themeColor,
toolbarColor: themeColor,
toolbarWidgetColor: Colors.white,
activeControlsWidgetColor: Theme.of(context).colorScheme.primary,
backgroundColor: themeColor,
),
iosUiSettings: const IOSUiSettings(
minimumAspectRatio: 1.0,
),
uiSettings: <PlatformUiSettings>[
AndroidUiSettings(
toolbarTitle: appLocalizations.product_edit_photo_title,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false,
statusBarColor: themeColor,
toolbarColor: themeColor,
toolbarWidgetColor: Colors.white,
activeControlsWidgetColor: Theme.of(context).colorScheme.primary,
backgroundColor: themeColor,
),
IOSUiSettings(
minimumAspectRatio: 1.0,
),
],
);
return croppedFile;
return File(croppedFile!.path);
}
18 changes: 16 additions & 2 deletions packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,21 @@ packages:
name: image_cropper
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
version: "2.0.0"
image_cropper_for_web:
dependency: transitive
description:
name: image_cropper_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
image_cropper_platform_interface:
dependency: transitive
description:
name: image_cropper_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
image_picker:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1157,5 +1171,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.15.1 <3.0.0"
dart: ">=2.16.1 <3.0.0"
flutter: ">=2.10.0"
2 changes: 1 addition & 1 deletion packages/smooth_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dependencies:
git:
url: https://github.com/cli1005/google_ml_barcode_scanner.git
ref: master
image_cropper: ^1.5.1
image_cropper: ^2.0.0
auto_size_text: ^3.0.0

dev_dependencies:
Expand Down

0 comments on commit bd10bbb

Please sign in to comment.