openFilterEditor method
void
openFilterEditor()
Opens the filter editor.
This method allows the user to apply filters to the current image and replaces the image with the filtered version if a filter is applied.
The filter editor is opened as a page, and the resulting filtered image is received as a
Uint8List
. If no filter is applied or the operation is canceled, the original image is retained.
Implementation
void openFilterEditor() async {
if (!mounted) return;
FilterMatrix? filters = await openPage(
FilterEditor.autoSource(
key: filterEditor,
file: editorImage.file,
byteArray: editorImage.byteArray,
assetPath: editorImage.assetPath,
networkUrl: editorImage.networkUrl,
initConfigs: FilterEditorInitConfigs(
theme: _theme,
configs: configs,
callbacks: callbacks,
transformConfigs: stateManager.transformConfigs,
layers: activeLayers,
mainImageSize: sizesManager.decodedImageSize,
mainBodySize: sizesManager.bodySize,
convertToUint8List: false,
appliedBlurFactor: stateManager.activeBlur,
appliedFilters: stateManager.activeFilters,
),
),
);
if (filters == null) return;
addHistory(
filters: filters,
heroScreenshotRequired: true,
);
setState(() {});
mainEditorCallbacks?.handleUpdateUI();
}