Skip to content

Commit dff61e9

Browse files
Updated version
1 parent 21c26ab commit dff61e9

File tree

3 files changed

+22
-34
lines changed

3 files changed

+22
-34
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.0.7] - 2023-08-09
2+
3+
* Added Ratio as new shape and arguments
4+
15
## [0.0.6]
26

37
* Added new param to CustomImageCrop for new image fit types

example/lib/main.dart

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,9 @@ class _MyHomePageState extends State<MyHomePage> {
9090
child: CustomImageCrop(
9191
cropController: controller,
9292
// image: const AssetImage('assets/test.png'), // Any Imageprovider will work, try with a NetworkImage for example...
93-
image: const NetworkImage(
94-
'https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png'),
93+
image: const NetworkImage('https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png'),
9594
shape: _currentShape,
96-
ratio: _currentShape == CustomCropShape.Ratio
97-
? Ratio(width: _width, height: _height)
98-
: null,
95+
ratio: _currentShape == CustomCropShape.Ratio ? Ratio(width: _width, height: _height) : null,
9996
canRotate: true,
10097
canMove: false,
10198
canScale: false,
@@ -105,47 +102,34 @@ class _MyHomePageState extends State<MyHomePage> {
105102
Row(
106103
mainAxisAlignment: MainAxisAlignment.spaceAround,
107104
children: [
108-
IconButton(
109-
icon: const Icon(Icons.refresh), onPressed: controller.reset),
110-
IconButton(
111-
icon: const Icon(Icons.zoom_in),
112-
onPressed: () =>
113-
controller.addTransition(CropImageData(scale: 1.33))),
114-
IconButton(
115-
icon: const Icon(Icons.zoom_out),
116-
onPressed: () =>
117-
controller.addTransition(CropImageData(scale: 0.75))),
118-
IconButton(
119-
icon: const Icon(Icons.rotate_left),
120-
onPressed: () =>
121-
controller.addTransition(CropImageData(angle: -pi / 4))),
122-
IconButton(
123-
icon: const Icon(Icons.rotate_right),
124-
onPressed: () =>
125-
controller.addTransition(CropImageData(angle: pi / 4))),
105+
IconButton(icon: const Icon(Icons.refresh), onPressed: controller.reset),
106+
IconButton(icon: const Icon(Icons.zoom_in), onPressed: () => controller.addTransition(CropImageData(scale: 1.33))),
107+
IconButton(icon: const Icon(Icons.zoom_out), onPressed: () => controller.addTransition(CropImageData(scale: 0.75))),
108+
IconButton(icon: const Icon(Icons.rotate_left), onPressed: () => controller.addTransition(CropImageData(angle: -pi / 4))),
109+
IconButton(icon: const Icon(Icons.rotate_right), onPressed: () => controller.addTransition(CropImageData(angle: pi / 4))),
126110
IconButton(
127111
icon: const Icon(Icons.crop),
128112
onPressed: () async {
129113
final image = await controller.onCropImage();
130114
if (image != null) {
131-
Navigator.of(context).push(MaterialPageRoute(
132-
builder: (BuildContext context) =>
133-
ResultScreen(image: image)));
115+
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => ResultScreen(image: image)));
134116
}
135117
},
136118
),
137119
PopupMenuButton<CustomCropShape>(
138120
icon: const Icon(Icons.crop_original),
139121
onSelected: _changeCropShape,
140122
itemBuilder: (BuildContext context) {
141-
return CustomCropShape.values.map((shape) {
142-
return PopupMenuItem<CustomCropShape>(
143-
value: shape,
144-
child: getShapeIcon(shape),
145-
);
146-
}).toList();
123+
return CustomCropShape.values.map(
124+
(shape) {
125+
return PopupMenuItem<CustomCropShape>(
126+
value: shape,
127+
child: getShapeIcon(shape),
128+
);
129+
},
130+
).toList();
147131
},
148-
)
132+
),
149133
],
150134
),
151135
if (_currentShape == CustomCropShape.Ratio)

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: custom_image_crop
22
description: An image cropper that is customizable. You can rotate, scale and translate either through gestures or a controller
3-
version: 0.0.6
3+
version: 0.0.7
44
homepage: https://github.com/icapps/flutter-custom-image-crop
55

66
environment:

0 commit comments

Comments
 (0)