ProImageEditor.asset constructor
ProImageEditor.asset(
- String assetPath, {
- Key? key,
- ProImageEditorConfigs configs = const ProImageEditorConfigs(),
- required ProImageEditorCallbacks callbacks,
This constructor creates a ProImageEditor
widget configured to edit an image loaded from the specified assetPath
.
The assetPath
parameter should specify the path to the image asset.
The key
parameter is an optional parameter used to provide a Key
to the widget for identification and state preservation.
The configs
parameter specifies the configuration options for the image editor. It defaults to an empty instance of ProImageEditorConfigs
.
The callbacks
parameter is required and specifies the callbacks to handle events and interactions within the image editor.
Example usage:
ProImageEditor.asset(
'assets/demo.png',
configs: ProImageEditorConfigs(),
callbacks: ProImageEditorCallbacks(
onImageEditingComplete: (Uint8List bytes) async {
/*
`Your code to handle the edited image. Upload it to your server as an example.
You can choose to use await, so that the load dialog remains visible until your code is ready,
or no async, so that the load dialog closes immediately.
*/
Navigator.pop(context);
},
),
)
Implementation
factory ProImageEditor.asset(
String assetPath, {
Key? key,
ProImageEditorConfigs configs = const ProImageEditorConfigs(),
required ProImageEditorCallbacks callbacks,
}) {
return ProImageEditor._(
key: key,
assetPath: assetPath,
configs: configs,
callbacks: callbacks,
);
}