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: _image.file,
byteArray: _image.byteArray,
assetPath: _image.assetPath,
networkUrl: _image.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();
}