-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnCrop not fired #101
Comments
Experiencing the same |
@talamaska @gliitterpuke I couldn't reproduce the issue with an example app. Can you provide your |
And can you try again with |
It was reproduced on older flutter. and previous version of the package I haven't had a chance to upgrade flutter and the package yet |
@talamaska I switched my flutter version to I'm waiting for your result of trying the latest version and the minimum code that reproduces the issue.
|
I have the same issue.
and my code is the following, the class requires bytes of the input image. import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:crop_your_image/crop_your_image.dart';
import 'package:phone_client/image_transformation/image2graph.dart';
class ImageCropping extends StatefulWidget {
const ImageCropping({Key? key, required this.imageData}) : super(key: key);
final Uint8List imageData;
@override
State<ImageCropping> createState() => _ImageCroppingState(imageData);
}
class _ImageCroppingState extends State<ImageCropping>
with WidgetsBindingObserver {
_ImageCroppingState(this.imageData);
final Uint8List imageData;
final CropController _cropController = CropController();
late Uint8List _croppedData = imageData;
final Color backgroundColour = const Color.fromARGB(255, 0, 204, 17);
@override
Widget build(BuildContext context) {
return Scaffold(
body: GestureDetector(
child: Crop(
controller: _cropController,
image: imageData,
onCropped: (croppedData) => setState(() {
_croppedData = croppedData;
}),
initialAreaBuilder: (rect) => Rect.fromLTRB(rect.left + 54,
rect.top + 62, rect.right - 54, rect.bottom - 62),
cornerDotBuilder: (size, edgeAlignment) =>
const DotControl(color: Color.fromARGB(255, 0, 204, 17)),
interactive: true,
baseColor: backgroundColour,
fixArea: false,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.miniEndDocked,
floatingActionButton: FloatingActionButton.small(
backgroundColor: Colors.black87,
foregroundColor: const Color.fromARGB(255, 75, 189, 0),
onPressed: () => _crop(context),
child: const Icon(Icons.done_all_rounded)));
}
void _crop(BuildContext context) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ImageTransformation(imageData: _croppedData)),
);
}
}
|
I can confirm image: ^4.1.3 and crop_your_image: ^0.7.5 plus flutter 3.13.8 the callback is firing again. |
Hi, @chooyan-eng Please correct me if I wrong, but seems that you don't handle error when calling ImageImageCropper finally. Now I got InvalidRectError by somehow on Xiaomi K50 pro and don't see any feedback from the crop_your_image library. Why that error happens is another story, but error should be handled. May be some way to get errors should be introduced. Thanks. |
Hi, just tried to update my dependency image package to latest 4.0.17 and after calling controller.crop() I see the Status is changing but the callback onCrop is not called.
The text was updated successfully, but these errors were encountered: