Closed Abhishek01039 closed 2 months ago
hello @hm21 can you please take a look at this?
Thanks!
Do I understand you correctly that you want to open the normal editor with all the subeditors (like paint or filter editor), but you want to initialize the editor with the specific size?
If so, you have now two options:
You open first the crop-rotate-editor as a standalone editor example and after your user crop the size he wants, you open the main-editor with all other editors, like the filter editor.
You can set the transform configs manually when you open the editor. The complicated case here is that you need to calculate your image size, and it's scale factor, to fit it to the screen. Below is a small example.
callbacks: ProImageEditorCallbacks(
mainEditorCallbacks: MainEditorCallbacks(
onAfterViewInit: () {
editorKey.currentState!.stateHistory.first.transformConfigs =
TransformConfigs(
/// Set the required scalefactor that it fit to the screen
scaleUser: 1.2,
/// Set the aspect ratio
aspectRatio: 1,
/// Set your crop size
cropRect: Rect.fromLTWH(
0,
0,
/// The crop size
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.width,
),
/// Ignore stuff below
angle: 0,
originalSize: Size.infinite,
scaleRotation: 1,
cropEditorScreenRatio: 0,
flipX: false,
flipY: false,
offset: const Offset(0, 0),
);
},
),
),
Btw, I will move your question to the Discuss tab in the Q&A category because that tab is better for questions.
Platforms
Android, iOS
Description
how do we force users to crop the image in the
aspectRatios
which we have given to them?Why
No response