done method

void done()

Handles the "Done" action, either by applying changes or closing the editor.

Implementation

void done() {
  if (_textCtrl.text.trim().isNotEmpty) {
    Navigator.of(context).pop(
      TextLayerData(
        text: _textCtrl.text.trim(),
        background: _getBackgroundColor,
        color: _getTextColor,
        align: align,
        fontScale: _fontScale,
        colorMode: backgroundColorMode,
        colorPickerPosition: colorPosition,
        textStyle: selectedTextStyle,
        customSecondaryColor: _secondaryColor != null,
      ),
    );
  } else {
    Navigator.of(context).pop();
  }
  textEditorCallbacks?.handleDone();
}