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

Main to fork #528

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions image_cropper/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: image_cropper
description: A Flutter plugin for Android, iOS and Web supports cropping images
version: 5.0.1
homepage: https://github.com/hnvn/flutter_image_cropper
publish_to: "none"

environment:
sdk: '>=2.18.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.3.3 <4.0.0'
flutter: ">=3.3.0"

flutter:
plugin:
Expand All @@ -21,10 +22,17 @@ flutter:
dependencies:
flutter:
sdk: flutter
image_cropper_platform_interface: ^5.0.0
image_cropper_for_web: ^3.0.0
# image_cropper_platform_interface:
# git:
# url: [email protected]:twinrdev/flutter_image_cropper.git
# path: image_cropper_platform_interface
image_cropper_for_web:
git:
url: [email protected]: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
plugin_platform_interface: ^2.0.0
57 changes: 32 additions & 25 deletions image_cropper_for_web/lib/src/cropper_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,47 @@ 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) {
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),
],
),
),
),
);
Expand Down Expand Up @@ -121,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(
Expand Down
5 changes: 3 additions & 2 deletions image_cropper_for_web/lib/src/cropper_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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),
Expand Down
16 changes: 10 additions & 6 deletions image_cropper_for_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@ 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: '>=3.3.3 <4.0.0'
flutter: ">=3.3.0"

dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter

image_cropper_platform_interface: ^5.0.0

js: ^0.6.3
image_cropper_platform_interface:
git:
url: [email protected]:twinrdev/flutter_image_cropper.git
path: image_cropper_platform_interface
# path: ../image_cropper_platform_interface

js: ^0.7.1

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
flutter_lints: ^3.0.2

flutter:
plugin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CroppedFile extends CroppedFileBase {

Future<Uint8List> get _bytes async {
if (_initBytes != null) {
return Future<Uint8List>.value(UnmodifiableUint8ListView(_initBytes!));
return Future<Uint8List>.value(UnmodifiableUint8ListView(_initBytes));
}
return http.readBytes(Uri.parse(path));
}
Expand Down
6 changes: 3 additions & 3 deletions image_cropper_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ^1.0.0
plugin_platform_interface: ^2.1.8
http: 1.2.1

dev_dependencies:
flutter_test:
Expand Down