Skip to content

how we can enforce user to crop the image? #147

Answered by hm21
Abhishek01039 asked this question in Q&A
Discussion options

You must be logged in to vote

If you just want to make sure the user cropped the image, I recommend you first create your custom appbar like in the example here. In this logic, you edit the “Done” button that if the user didn't crop the image, you display as example a popup which say he must crop the image. To check if the user cropped the image, you can check it like below.

if (editorKey.currentState!.stateManager.transformConfigs.isEmpty) {
  /// show your warning
  /// 
  /// You can also check if the aspect ratio is set like that
  /// editorKey.currentState!.stateManager.transformConfigs.aspectRatio!=-1
  return;
}

To open an editor as a standalone editor, you can follow the example here.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@hm21
Comment options

hm21 Jun 27, 2024
Maintainer

@Abhishek01039
Comment options

@Abhishek01039
Comment options

@hm21
Comment options

hm21 Jun 28, 2024
Maintainer

Answer selected by hm21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #146 on June 27, 2024 16:25.