From c4298e3d2b7992e5ac9c6ba1456142636ef36970 Mon Sep 17 00:00:00 2001 From: Brijesh Marvaniya Date: Wed, 12 Jul 2023 20:49:16 +0530 Subject: [PATCH 1/4] add scroll in image cropping alert dialog --- image_cropper/pubspec.yaml | 6 ++- .../lib/src/cropper_dialog.dart | 52 +++++++++++-------- image_cropper_for_web/pubspec.yaml | 5 +- image_cropper_platform_interface/pubspec.yaml | 2 +- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/image_cropper/pubspec.yaml b/image_cropper/pubspec.yaml index 7e7f6d17..b0b8803c 100644 --- a/image_cropper/pubspec.yaml +++ b/image_cropper/pubspec.yaml @@ -21,8 +21,10 @@ flutter: dependencies: flutter: sdk: flutter - image_cropper_platform_interface: ^5.0.0 - image_cropper_for_web: ^3.0.0 + image_cropper_platform_interface: + path: ../image_cropper_platform_interface + image_cropper_for_web: + path: ../image_cropper_for_web dev_dependencies: flutter_test: diff --git a/image_cropper_for_web/lib/src/cropper_dialog.dart b/image_cropper_for_web/lib/src/cropper_dialog.dart index 95ccf645..80acacee 100644 --- a/image_cropper_for_web/lib/src/cropper_dialog.dart +++ b/image_cropper_for_web/lib/src/cropper_dialog.dart @@ -21,30 +21,36 @@ class CropperDialog extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - width: cropperContainerWidth + 2 * 24.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.0), - ), - child: IntrinsicHeight( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - _header(context), - const Divider(height: 1.0, thickness: 1.0), - Padding( - padding: const EdgeInsets.only( - top: 24.0, - left: 24.0, - right: 24.0, - bottom: 8.0, - ), - child: _body(context), + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + width: cropperContainerWidth + 2 * 24.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + ), + child: IntrinsicHeight( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + _header(context), + const Divider(height: 1.0, thickness: 1.0), + Padding( + padding: const EdgeInsets.only( + top: 24.0, + left: 24.0, + right: 24.0, + bottom: 8.0, + ), + child: _body(context), + ), + const Divider(height: 1.0, thickness: 1.0), + _footer(context), + ], ), - const Divider(height: 1.0, thickness: 1.0), - _footer(context), - ], + ), ), ), ); diff --git a/image_cropper_for_web/pubspec.yaml b/image_cropper_for_web/pubspec.yaml index 1cf1fee0..5f2a62f9 100644 --- a/image_cropper_for_web/pubspec.yaml +++ b/image_cropper_for_web/pubspec.yaml @@ -13,9 +13,10 @@ dependencies: flutter_web_plugins: sdk: flutter - image_cropper_platform_interface: ^5.0.0 + image_cropper_platform_interface: + path: /Users/brijeshmarvaniya/Documents/Twinr/flutter_image_cropper/image_cropper_platform_interface - js: ^0.6.3 + js: ^0.6.5 dev_dependencies: diff --git a/image_cropper_platform_interface/pubspec.yaml b/image_cropper_platform_interface/pubspec.yaml index 11ebd638..f3443749 100644 --- a/image_cropper_platform_interface/pubspec.yaml +++ b/image_cropper_platform_interface/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter plugin_platform_interface: ^2.1.0 - http: ^1.0.0 + http: 0.13.6 dev_dependencies: flutter_test: From 9569df92b201ad281615340668e84578c5f95341 Mon Sep 17 00:00:00 2001 From: Gaurav Parvadiya Date: Wed, 12 Jul 2023 13:11:59 -0400 Subject: [PATCH 2/4] fix path issue --- image_cropper_for_web/pubspec.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/image_cropper_for_web/pubspec.yaml b/image_cropper_for_web/pubspec.yaml index 5f2a62f9..7b30e6af 100644 --- a/image_cropper_for_web/pubspec.yaml +++ b/image_cropper_for_web/pubspec.yaml @@ -2,23 +2,26 @@ name: image_cropper_for_web description: A Flutter plugin for Web supports cropping images repository: https://github.com/hnvn/flutter_image_cropper version: 3.0.0 +publish_to: "none" environment: - sdk: '>=2.18.0 <4.0.0' - flutter: '>=3.3.0' + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: flutter: sdk: flutter flutter_web_plugins: sdk: flutter - + image_cropper_platform_interface: - path: /Users/brijeshmarvaniya/Documents/Twinr/flutter_image_cropper/image_cropper_platform_interface + git: + url: git@github.com:twinrdev/flutter_image_cropper.git + path: image_cropper_platform_interface + # path: ../image_cropper_platform_interface js: ^0.6.5 - dev_dependencies: flutter_test: sdk: flutter From d078d1b3dd248616650d797defd5a1f161837d9d Mon Sep 17 00:00:00 2001 From: Gaurav Parvadiya Date: Wed, 12 Jul 2023 13:12:53 -0400 Subject: [PATCH 3/4] Fix path issues --- image_cropper/pubspec.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/image_cropper/pubspec.yaml b/image_cropper/pubspec.yaml index b0b8803c..516c72ee 100644 --- a/image_cropper/pubspec.yaml +++ b/image_cropper/pubspec.yaml @@ -2,10 +2,11 @@ name: image_cropper description: A Flutter plugin for Android, iOS and Web supports cropping images version: 5.0.0 homepage: https://github.com/hnvn/flutter_image_cropper +publish_to: "none" environment: - sdk: '>=2.18.0 <4.0.0' - flutter: '>=3.3.0' + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" flutter: plugin: @@ -21,12 +22,17 @@ flutter: dependencies: flutter: sdk: flutter - image_cropper_platform_interface: - path: ../image_cropper_platform_interface + # image_cropper_platform_interface: + # git: + # url: git@github.com:twinrdev/flutter_image_cropper.git + # path: image_cropper_platform_interface image_cropper_for_web: - path: ../image_cropper_for_web + git: + url: git@github.com:twinrdev/flutter_image_cropper.git + path: image_cropper_for_web + # path: ../image_cropper_for_web dev_dependencies: flutter_test: sdk: flutter - plugin_platform_interface: ^2.0.0 \ No newline at end of file + plugin_platform_interface: ^2.0.0 From 834026a44de5a129fd34c3b62e90b9f8d13d63b6 Mon Sep 17 00:00:00 2001 From: Brijesh Marvaniya Date: Fri, 12 Apr 2024 16:01:20 +0530 Subject: [PATCH 4/4] update package versions in pubspec --- image_cropper/pubspec.yaml | 2 +- image_cropper_for_web/lib/src/cropper_dialog.dart | 5 +++-- image_cropper_for_web/lib/src/cropper_page.dart | 5 +++-- image_cropper_for_web/pubspec.yaml | 6 +++--- .../lib/src/models/cropped_file/html.dart | 2 +- image_cropper_platform_interface/pubspec.yaml | 6 +++--- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/image_cropper/pubspec.yaml b/image_cropper/pubspec.yaml index cbb80e80..12650db4 100644 --- a/image_cropper/pubspec.yaml +++ b/image_cropper/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/hnvn/flutter_image_cropper publish_to: "none" environment: - sdk: ">=2.18.0 <4.0.0" + sdk: '>=3.3.3 <4.0.0' flutter: ">=3.3.0" flutter: diff --git a/image_cropper_for_web/lib/src/cropper_dialog.dart b/image_cropper_for_web/lib/src/cropper_dialog.dart index 80acacee..8091e2c4 100644 --- a/image_cropper_for_web/lib/src/cropper_dialog.dart +++ b/image_cropper_for_web/lib/src/cropper_dialog.dart @@ -10,14 +10,14 @@ class CropperDialog extends StatelessWidget { final WebTranslations translations; const CropperDialog({ - Key? key, + super.key, required this.cropper, required this.crop, required this.rotate, required this.cropperContainerWidth, required this.cropperContainerHeight, required this.translations, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -127,6 +127,7 @@ class CropperDialog extends StatelessWidget { ElevatedButton( onPressed: () async { final result = await crop(); + if (!context.mounted) return; Navigator.of(context).pop(result); }, style: ElevatedButton.styleFrom( diff --git a/image_cropper_for_web/lib/src/cropper_page.dart b/image_cropper_for_web/lib/src/cropper_page.dart index d59d819e..4f89ae66 100644 --- a/image_cropper_for_web/lib/src/cropper_page.dart +++ b/image_cropper_for_web/lib/src/cropper_page.dart @@ -11,14 +11,14 @@ class CropperPage extends StatelessWidget { final WebTranslations translations; const CropperPage({ - Key? key, + super.key, required this.cropper, required this.crop, required this.rotate, required this.cropperContainerWidth, required this.cropperContainerHeight, required this.translations, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -29,6 +29,7 @@ class CropperPage extends StatelessWidget { IconButton( onPressed: () async { final result = await crop(); + if (!context.mounted) return; Navigator.of(context).pop(result); }, icon: const Icon(Icons.done), diff --git a/image_cropper_for_web/pubspec.yaml b/image_cropper_for_web/pubspec.yaml index 7b30e6af..403dd2f1 100644 --- a/image_cropper_for_web/pubspec.yaml +++ b/image_cropper_for_web/pubspec.yaml @@ -5,7 +5,7 @@ version: 3.0.0 publish_to: "none" environment: - sdk: ">=2.18.0 <4.0.0" + sdk: '>=3.3.3 <4.0.0' flutter: ">=3.3.0" dependencies: @@ -20,12 +20,12 @@ dependencies: path: image_cropper_platform_interface # path: ../image_cropper_platform_interface - js: ^0.6.5 + js: ^0.7.1 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^1.0.0 + flutter_lints: ^3.0.2 flutter: plugin: diff --git a/image_cropper_platform_interface/lib/src/models/cropped_file/html.dart b/image_cropper_platform_interface/lib/src/models/cropped_file/html.dart index 248b6b56..8ddca037 100644 --- a/image_cropper_platform_interface/lib/src/models/cropped_file/html.dart +++ b/image_cropper_platform_interface/lib/src/models/cropped_file/html.dart @@ -29,7 +29,7 @@ class CroppedFile extends CroppedFileBase { Future get _bytes async { if (_initBytes != null) { - return Future.value(UnmodifiableUint8ListView(_initBytes!)); + return Future.value(UnmodifiableUint8ListView(_initBytes)); } return http.readBytes(Uri.parse(path)); } diff --git a/image_cropper_platform_interface/pubspec.yaml b/image_cropper_platform_interface/pubspec.yaml index f3443749..97fb72e8 100644 --- a/image_cropper_platform_interface/pubspec.yaml +++ b/image_cropper_platform_interface/pubspec.yaml @@ -4,14 +4,14 @@ repository: https://github.com/hnvn/flutter_image_cropper version: 5.0.0 environment: - sdk: '>=2.18.0 <4.0.0' + sdk: '>=3.3.3 <4.0.0' flutter: '>=3.3.0' dependencies: flutter: sdk: flutter - plugin_platform_interface: ^2.1.0 - http: 0.13.6 + plugin_platform_interface: ^2.1.8 + http: 1.2.1 dev_dependencies: flutter_test: