Skip to content

Commit

Permalink
version up to 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chooyan-eng committed Mar 18, 2021
1 parent 71f62af commit 78e40c6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.5.0] - 2021.03.18
* Enable to configure corner Dots with whatever Widget.
* Enable to configure cropping mask colors and base colors.

## [0.4.0] - 2021.03.18
* Enable to change original image via `CropController`
* Add callback when cropping area moves.
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ final _controller = CropController();
Widget build(BuildContext context) {
return Crop(
image: _imageData,
aspectRatio: 4 / 3,
initialSize: 0.5,
withCircleUi: false,
controller: _controller,
onCropped: (image) {
// do something with image data
}
controller: _controller,
);
}
```
Expand Down Expand Up @@ -59,16 +56,19 @@ final _controller = CropController();
Widget build(BuildContext context) {
return Crop(
image: _imageData,
aspectRatio: 4 / 3,
initialSize: 0.5,
withCircleUi: false,
controller: _controller,
onCropped: (image) {
// do something with image data
},
aspectRatio: 4 / 3,
initialSize: 0.5,
withCircleUi: false,
baseColor: Colors.blue.shade900,
maskColor: Colors.white.withAlpha(100),
onMoved: (newRect) {
// do something with current cropping area.
}
controller: _controller,
cornerDotBuilder: (size, cornerIndex) => const DotControl(color: Colors.blue),
);
}
```
Expand All @@ -78,9 +78,12 @@ Widget build(BuildContext context) {
- `aspectRatio` can be changed dynamically via setter of `CropController.aspectRatio`. (see below)
- `initialSize` is the initial size of cropping area. `1.0` (or `null`, by default) fits the size of image, which means cropping area extends as much as possible. `0.5` would be the half. This value is also referred when `aspectRatio` changes via `CropController.aspectRatio`.
- `withCircleUi` flag is to decide the shape of cropping UI. If `true`, `aspectRatio` is automatically set `1.0` and the shape of cropping UI would be circle. 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`.
- `baseColor` is the color of the mask widget which is placed over the cropping editor.
- `maskColor` is the color of the base color of the cropping editor.
- `onMoved` callback is called when cropping area is moved regardless of its reasons. `newRect` of argument is current `Rect` of cropping area.
- `cornerDotBuilder` is the builder to build Widget placed at corners. The builder passes `size` which widget must follow and `cornerIndex` which indicates the position: 0: left-top, 1: right-top, 2: left-bottom, 3: right-bottom.

In addition, `image`, `aspectRatio`, `withCircleUi` and `rect` can also be changed via `CropController`.
In addition, `image`, `aspectRatio`, `withCircleUi` and `rect` can also be changed via `CropController`, and other properties, such as `baseColor`, `maskColor` and `cornerDotBuilder`, can be changed by `setState`.

# Contact

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: 0.4.0
version: 0.5.0
homepage: https://github.com/chooyan-eng/crop_your_image

environment:
Expand Down

0 comments on commit 78e40c6

Please sign in to comment.