Skip to content
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

Image cropper screen is not getting open Flutter as module #493

Open
nikunjramiweave opened this issue Jun 5, 2024 · 0 comments
Open

Image cropper screen is not getting open Flutter as module #493

nikunjramiweave opened this issue Jun 5, 2024 · 0 comments

Comments

@nikunjramiweave
Copy link

nikunjramiweave commented Jun 5, 2024

Hey

I have added Flutter as a module. I am trying to open the image cropper after the image picker but it is not getting open in ios side working fine in Android. Not getting any error

Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (7 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1

ios Native Code to open profile screen.

var flutterPageArgs : [String:String] = [:]
        var flutterArgs : [String:Any] = [:]
        flutterArgs["methodName"] = "UserProfile"
        flutterArgs["args"] = flutterPageArgs
        let vc = FlutterViewController(flutterPageArgs: flutterArgs)
        self.present(vc, animated: true)

flutter image cropper code

Future<void> getImage(ImageSource source, {isDoc = false}) async {
    final pickedFile =
        await ImagePicker().pickImage(source: ImageSource.gallery);
    if (pickedFile != null) {
      setState(() {
        _pickedFile = pickedFile;
      });
    }
  }

  Future<void> cropImage() async {
    if (_pickedFile != null) {
      final croppedFile = await ImageCropper().cropImage(
        sourcePath: _pickedFile!.path,
        compressFormat: ImageCompressFormat.jpg,
        compressQuality: 100,
        uiSettings: [
          AndroidUiSettings(
              toolbarTitle: 'Cropper',
              toolbarColor: Colors.deepOrange,
              toolbarWidgetColor: Colors.white,
              initAspectRatio: CropAspectRatioPreset.original,
              lockAspectRatio: false),
          IOSUiSettings(
            title: 'Cropper',
          ),
          WebUiSettings(
            context: context,
            presentStyle: CropperPresentStyle.dialog,
            boundary: const CroppieBoundary(
              width: 520,
              height: 520,
            ),
            viewPort:
                const CroppieViewPort(width: 480, height: 480, type: 'circle'),
            enableExif: true,
            enableZoom: true,
            showZoomer: true,
          ),
        ],
      );
      if (croppedFile != null) {
        setState(() {
          _croppedFile = croppedFile;
        });
      }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant