繁体   English   中英

如何在 flutter 中使用扩展图像裁剪图像

[英]How to crop image using extended_image in flutter

拍摄图像后,我正在尝试使用 flutter 中的扩展图像编辑图像,但我无法做到。 如何在 flutter 中使用扩展图像。

 final picker = ImagePicker();

Future getImage() async {
final pickedFile = await picker.getImage(source: ImageSource.camera);

setState(() {
  _image = File(pickedFile.path);
});


  _croppedImage =   ExtendedImage.file(
  _image,
  fit: BoxFit.contain,
  mode: ExtendedImageMode.editor,
  extendedImageEditorKey: editorKey,
  initEditorConfigHandler: (state) {
    return EditorConfig(
        maxScale: 8.0,
        cropRectPadding: EdgeInsets.all(20.0),
        hitTestSize: 20.0,
        cropAspectRatio: CropAspectRatios.original);
  },
);

}

但它不提供编辑器。

您需要在小部件树中使用 ExtendedImage.file,而不是 function,例如作者的 github, image_editor_demo

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM