cropperx
v1.1.1An image cropper package made in Flutter. Can be used to crop & rotate images.
Архив пакета: https://pubdev.letsnova.ru/api/archives/cropperx/1.1.1.tar.gz
Установка
dart pub add cropperxREADME
CropperX
A cropper package made fully in Flutter.
| Circle | Rectangle | Grid |
|---|---|---|
![]() |
![]() |
![]() |
Types of overlays
The overlay can be defined by adding an overlay type through the overlayType parameter. The following types are currently supported:
- OverlayType.none: No overlay at all.
- OverlayType.circle: An overlay with a circular gap.
- OverlayType.rectangle: An overlay with a rectangular gap, takes the given aspect ratio.
- OverlayType.grid: An overlay of grid lines: 2 horizontal and 2 vertical, evenly spaced.
- OverlayType.gridHorizontal: An overlay of 2 horizontal grid lines, evenly spaced.
- OverlayType.gridVertical: An overlay of 2 vertical grid lines, evenly spaced.
Rotating the image
The image rotation can be defined through the rotationTurns parameter. The default value is 0, corresponding to 0 degrees of rotation. Making the value larger by 1 will rotate the image 90 degrees clockwise, making it smaller will rotate the image 90 degrees counterclockwise. 0 to 4 is not a limit, so going above or below these values will keep rotating the image.
Example
// Import package
import 'package:cropperx/cropper.dart';
// Define a key
final _cropperKey = GlobalKey(debugLabel: 'cropperKey');
// Add the Cropper widget to your tree, using the above key and adding the image to crop
Cropper(
cropperKey: _cropperKey, // Use your key here
image: Image.network(
'https://i.pinimg.com/originals/6b/4d/18/6b4d18c0b756ab20c3591490dfc10090.jpg',
),
)
// Get the cropped image as bytes
final imageBytes = await Cropper.crop(
cropperKey: _cropperKey, // Reference it through the key
)
История изменений
1.1.1 - 2022/07/14
- Fix weird gesture handling when image was rotated
- Fix image placement after rotation
1.1.0 - 2022/05/21
- Add Flutter 3 support
- Fix overlay not filling viewport
- Center image on initial image load
1.0.0 - 2021/12/07
- Fix Rectangle overlay not showing
0.0.3 - 2021/10/08
- Make pixelRatio configurable when calling
crop
0.0.2 - 2021/10/05
- Add Flutter Web support
- Fix incorrect circle frame when parent's width exceeds height
0.0.1 - 2021/10/04
- Initial release



