Skip to content

Commit

Permalink
version up to 2.0.0-dev.3
Browse files Browse the repository at this point in the history
  • Loading branch information
chooyan-eng committed Dec 9, 2024
1 parent acef7bd commit ede90e3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.0.0-dev.3] - 2024.12.9
* Change the type of `initialRectBuilder` to `InitialRectBuilder`, and now legacy `initialArea` and `initialSize` are removed and merged into `InitialRectBuilder`.
* Add `InitialRectBuilder.withSizeAndRatio` to configure initial `aspectRatio`.

## [2.0.0-dev.2] - 2024.12.08
* Add undo / redo related features. See [README.md](README.md) for more details.

Expand Down
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Widget build(BuildContext context) {

Then, `Crop` widget will automatically display cropping editor UI on users screen with given image.

By passing `CropController` instance to `controller` argument of `Crop`'s constructor, you can controll the `Crop` widget from anywhere on your source code.
By passing `CropController` instance to `controller` argument of `Crop`'s constructor, you can control the `Crop` widget from anywhere on your source code.

For example, when you want to crop the image with the current crop rect, you can just call `_controller.crop()` whenever you want, such like the code below.

Expand Down Expand Up @@ -109,11 +109,23 @@ Widget build(BuildContext context) {
// do something with image data
},
aspectRatio: 4 / 3,
// initialSize: 0.5,
// initialArea: Rect.fromLTWH(240, 212, 800, 600),
initialRectBuilder: (rect) => Rect.fromLTRB(
rect.left + 24, rect.top + 32, rect.right - 24, rect.bottom - 32
),
initialRectBuilder: InitialRectBuilder.withBuilder((viewportRect, imageRect) {
return Rect.fromLTRB(
viewportRect.left + 24,
viewportRect.top + 32,
viewportRect.right - 24,
viewportRect.bottom - 32,
);
}),
// initialRectBuilder: InitialRectBuilder.withArea(
// ImageBasedRect.fromLTWH(240, 212, 800, 600),
// ),
// initialRectBuilder: InitialRectBuilder.withSizeAndRatio(
// size: 0.5,
// aspectRatio: 4 / 3,
// ),
// withCircleUi: true,
baseColor: Colors.blue.shade900,
maskColor: Colors.white.withAlpha(100),
Expand All @@ -133,6 +145,7 @@ Widget build(BuildContext context) {
clipBehavior: Clip.none,
interactive: true,
// fixCropRect: true,
// formatDetector: (image) {},
// imageCropper: myCustomImageCropper,
// imageParser: (image, {format}) {},
Expand All @@ -147,8 +160,7 @@ Widget build(BuildContext context) {
|controller|CropController|Controller for managing cropping operation.|
|aspectRatio|double?| Initial aspect ratio of crop rect. Set `null` or just omit if you want to crop images with any aspect ratio. `aspectRatio` can be changed dynamically via setter of `CropController.aspectRatio`. (see below)|
|initialSize|double?| is the initial size of crop rect. `1.0` (or `null`, by default) fits the size of image, which means crop rect extends as much as possible. `0.5` would be the half. This value is also referred when `aspectRatio` changes via `CropController.aspectRatio`.|
|initialArea|Rect?|Initial `Rect` of crop rect based on actual image size.|
|initialRectBuilder|Rect Function(Rect)|Callback to decide initial `Rect` of crop rect based on viewport of `Crop` itself. `Rect` of `Crop`'s viewport is passed as an argument of the callback.|
|initialRectBuilder|InitialRectBuilder?|An object preserving configuration for building the initial crop rect. `InitialRectBuilder.withBuilder` enables you to configure the rect with a function to decide initial `Rect` of crop rect based on viewport of `Crop` itself. `InitialRectBuilder.withArea` enables you to configure the rect with `ImageBasedRect` which is based on actual image size. `InitialRectBuilder.withSizeAndRatio` enables you to configure the rect with `size` and `aspectRatio`.|
|withCircleUi|bool|Flag to decide the shape of cropping UI. If `true`, the shape of cropping UI is circle and `aspectRatio` is automatically set `1.0`. Note that this flag does NOT affect to the result of cropping image. If you want cropped images with circle shape, call `CropController.cropCircle` instead of `CropController.crop`.|
|maskColor|Color?|Color of the mask widget which is placed over the cropping editor.|
|baseColor|Color?|Color of the base color of the cropping editor.|
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: crop_your_image
description: crop_your_image helps your app to embed Widgets for cropping images.
version: 2.0.0-dev.2
version: 2.0.0-dev.3
homepage: https://github.com/chooyan-eng/crop_your_image
topics:
- crop
Expand Down

0 comments on commit ede90e3

Please sign in to comment.