Giter VIP home page Giter VIP logo

Comments (11)

ikbendewilliam avatar ikbendewilliam commented on June 18, 2024

Does it return null or an empty image?
Do you wait for it to be loaded or crop while loading?
Have you tried running the example?

from flutter-custom-image-crop.

umamaheswari2023 avatar umamaheswari2023 commented on June 18, 2024

Yes I have tried with your example, but I found one scenario in which the onCropImage is not working. If I am picking the image from image_picker and set the Uint8List value to the CustomImageCrop widget, then this is not working. because the controller is not updated to the newly added image.

Could you please suggest a solution for updating the controller on selecting the image dynamically?

from flutter-custom-image-crop.

ikbendewilliam avatar ikbendewilliam commented on June 18, 2024

Ah, that is correct. We should add a didUpdateWidget(oldWidget) method where we can then update the controller.
Feel free to create a PR for this! (I can maybe fix it somewhere this week, but it might take a few days).

from flutter-custom-image-crop.

umamaheswari2023 avatar umamaheswari2023 commented on June 18, 2024

Is it fine to call the _getImage method under the didUpdateWidget function?

from flutter-custom-image-crop.

ikbendewilliam avatar ikbendewilliam commented on June 18, 2024

You can definetly try adding this and seeing if this fixed the issue.
That is what we're doing in the didChangeDependencies as well. Can you share a piece of your code where you load the image?

from flutter-custom-image-crop.

umamaheswari2023 avatar umamaheswari2023 commented on June 18, 2024

By this was I am loading my image into the CustomImageCrop

Consumer<changeNotifier>(
                    builder: (context, viewModel, child) {
                  return Container(
                    height: MediaQuery.of(context).size.height / 2,
                    width: MediaQuery.of(context).size.width / 2,
                    child: CustomImageCrop(
                      cropController: viewModel.cropController,
                      shape: CustomCropShape.Square,
                      imageFit: CustomImageFit.fitVisibleSpace,
                      image: MemoryImage(
                          viewModel.binaryImage ?? viewModel.profileImage!),
                    ),
                  );
                }),

Also while picking the image I am updating the binary image as

binaryImage = (await viewModel.cropController.onCropImage())?.bytes;

Could you please fix this ASAP, I am stuck with my implementation for this.

from flutter-custom-image-crop.

umamaheswari2023 avatar umamaheswari2023 commented on June 18, 2024

@ikbendewilliam I have tested it by implementing the didUpdateWidget it was working fine. Can you please fix the same in your plugin?

from flutter-custom-image-crop.

ikbendewilliam avatar ikbendewilliam commented on June 18, 2024

@umamaheswari2023 I've created a PR for this #41, can you double check that this fixes your issue? You can use it by adding this to your pubspec.yaml

dependency_overrides: 
  custom_image_crop:
    git:
      url: https://github.com/icapps/flutter-custom-image-crop
      ref: 7a04a982f4b565c08870c844399398d5e04aacb0

from flutter-custom-image-crop.

umamaheswari2023 avatar umamaheswari2023 commented on June 18, 2024

Hi @ikbendewilliam This PR fixed my issue. Can you please merge this PR, So that I can use the stable version.

from flutter-custom-image-crop.

ikbendewilliam avatar ikbendewilliam commented on June 18, 2024

Perfect, yes I'll merge and release asap

from flutter-custom-image-crop.

ikbendewilliam avatar ikbendewilliam commented on June 18, 2024

Released as 0.0.10

from flutter-custom-image-crop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.