toggleSuperscript method

void toggleSuperscript()
inherited

Toggles the TextMetadata.decoration between TextDecorationEnum.none and TextDecorationEnum.lineThrough.

Implementation

void toggleSuperscript() {
  final TextMetadata tempMetadata =
      metadata ?? RichTextEditorController.defaultMetadata;

  final TextMetadata changedMetadata = tempMetadata.copyWith(
    fontFeatures: tempMetadata.fontFeatures?.firstOrNull ==
            const FontFeature.superscripts()
        ? const []
        : const [FontFeature.superscripts()],
  );

  changeStyleOnSelectionChange(
    changedMetadata: changedMetadata,
    change: TextMetadataChange.fontFeatures,
    modifiedDeltas: deltas.copy,
    selection: selection,
  );
}