picker_image_cropper 0.0.6
picker_image_cropper: ^0.0.6 copied to clipboard
A modern Flutter package for selecting and cropping images with a professional UI and advanced features.
0.0.6 #
- Fix bug gradle
0.0.4 #
⚡ Performance — Native crop pipeline (~10× faster) #
- Native image load: Added
resizeImageForCropper()call on first open — usesBitmapFactory.inSampleSize(Android),CGImageSourceCreateThumbnailAtIndex(iOS/macOS), GDI+ (Windows), gdk-pixbuf (Linux), and Canvas 2D (Web). Preview load drops from ~11 s to ~800 ms on a 2 MB JPEG. - Native crop:
_performCropWithResultnow callscropImageNative()first (non-web). Full decode → rotate → crop → encode runs natively on a background thread in ~100–200 ms, replacing a Dartcompute()isolate that took ~3 700 ms. - WebP output: Added
OutputFormatenum (jpeg,png,webpLossy,webpLossless). PassoutputFormat: OutputFormat.webpLossyfor ~30 % smaller files. Circle crops auto-upgrade topng/webpLosslessfor transparency. Dart isolate fallback (web) still uses JPEG/PNG. - Dart isolate fallback: Still available for web or when native fails.
_compressImageBytesIsolateruns viacompute()(background isolate) instead of blocking the UI thread.
🔧 Fixes #
- Web/WASM: Removed
dart:iodirect import frommodern_image_cropper.dart— file I/O is now fully routed through conditional platform stubs (file_reader_native.dart/file_reader_stub.dart). Package is web-compatible again. - Extension bug:
_saveToTempFilePathwas always writing.pngfor rectangle crops — now correctly uses the chosenOutputFormatextension. return Futurelint: Fixedreturn _pushCropper(...)insidetryblock (missingawait) incapturePhoto.- Removed unused methods:
_performCrop,_calculateDraggableCropRect,_calculateStaticCropRect,_applyCircleMask.
🆕 API additions #
OutputFormatenum exported from the package barrel —jpeg|png|webpLossy|webpLossless.outputFormatparameter added toModernImageCropper,pickAndCrop,capturePhoto,captureAndCrop,pickFromGalleryAndCrop,cropImage,cropImageWithCallback,cropImageWithResult,pickAndCropWithResult,pickAndCropWithCallback. Default isOutputFormat.jpeg— fully backwards-compatible.
0.0.3 #
🐛 Bug Fixes & Compatibility #
- Web/WASM compatibility: Removed unconditional
dart:ioimports that broke web and WASM compilation CropResultno longer holds adart:io Filefield — replaced withString? filePathfor full cross-platform support. On native platforms reconstruct withFile(result.filePath!)ModernImageCropperandImagePickerCropperno longer importdart:iodirectly — file I/O is handled via conditional imports (dart.library.io) with web stubs- API change:
cropImage,cropImageWithCallback,cropImageWithResultnow takeString imagePathinstead ofFile imageFile - API change:
OnImagePickerCompletedcallback signature changed fromFunction(File? file, Uint8List? bytes)toFunction(String? filePath, Uint8List? bytes) - API change:
OnFilePickerCompletedcallback signature changed fromFunction(File file)toFunction(String filePath) - Fixed
ListTileassertion: wrappedSwitchListTileinMaterial(color: Colors.transparent)inside example app to prevent invisible ink splash
0.0.2 #
- Fix support for web
0.0.1 #
✨ New Features #
- Camera Capture: Added
capturePhoto()method for direct camera capture with automatic cropping - Dual Output Support: Get both bytes (Uint8List) and file outputs with path information
- Modern UI: Professional-looking interface with customizable themes
- Multiple Aspect Ratios: Support for free, square, 4:3, 16:9, 3:2, and 3:4 ratios
- Shape Options: Rectangle and circle cropping overlays
- Interactive Cropping: Draggable crop box with resize handles
- Image Transformations: Rotate, zoom, and reset functionality
- Grid Overlay: Toggle grid lines for better alignment
- Theme Customization: Dark, light, and blue themes
- Cross-platform: Works on Android, iOS, and other Flutter platforms
📱 Camera Integration #
ImagePickerCropper.capturePhoto()- Capture from camera and crop in one stepImagePickerCropper.pickFromGalleryAndCrop()- Pick from gallery and cropImagePickerCropper.captureAndCrop()- Alternative camera capture method- Comprehensive error handling for camera permissions and availability
- Support for compression settings and quality control
🎨 UI/UX Improvements #
- Modern, professional interface design
- Smooth animations and transitions
- Responsive layout for different screen sizes
- Intuitive gesture controls
🔧 Technical Features #
- Efficient image processing with the
imagepackage - Memory-optimized handling of large images
- Support for both web and mobile platforms
📚 Documentation #
- Comprehensive README with usage examples
- Complete example app demonstrating all features
- Error handling guidelines
- API reference documentation