RichTextEditor constructor Null safety

const RichTextEditor(
  1. {Key? key,
  2. TextStyle? labelTextStyle,
  3. bool showPreview = true,
  4. String? initialValue,
  5. int? maxLength,
  6. String placeholderMarker = "\\\$",
  7. List<RichTextPlaceholder> placeholders = const [],
  8. dynamic onChanged(
    1. String
    ) = RichTextEditor._doNothingWithResult,
  9. EditorDecoration editorDecoration = const EditorDecoration(),
  10. List<String> availableColors = TextConstants.defaultColors,
  11. bool alwaysShowButtons = false,
  12. HtmlEditorController? controller,
  13. List<Widget>? additionalActionButtons,
  14. bool animatePreviewToEditorPosition = true,
  15. bool autofocus = false,
  16. RendererDecoration previewDecoration = const RendererDecoration(),
  17. List<ButtonRowType> availableButtons = ButtonRowType.values}

Creates a new instance of a HTML text editor. editorLabel is displayed at the text input, styled by labelStyle when not focused, styled by focusedLabelStyle else

cursorColor is the color of the cursor of the text input

inputStyle text-style of the written code

A rendered preview is displayed, when showPreview is set to true, with an optional previewLabel is displayed below it

onChanged is called each time, the HTML input changes providing the written code as parameter

An optional maxLength can be provided, which is applied in the code input, not at the rendered text.

If initialValue is set, the provided text is loaded into the editor.

If animatePreviewToEditorPosition is set AND showPreview is true, the preview will scroll along with the text input of the editor.

It is possible to use placeholders in the code. They have to be enclosed with placeholderMarker. If the marker is set to "$" for example, it could look like $VARIABLE$, which would get substituted in the richtext.

Per default, all button types are displayed above the editor textfield. availableButtons can be provided to specify the visible buttons


const RichTextEditor({
  Key? key,
  this.showPreview = true,
  this.placeholderMarker = "\\\$",
  this.placeholders = const [],
  this.onChanged = RichTextEditor._doNothingWithResult,
  this.editorDecoration = const EditorDecoration(),
  this.availableColors = TextConstants.defaultColors,
  this.alwaysShowButtons = false,
  this.animatePreviewToEditorPosition = true,
  this.autofocus = false,
  this.previewDecoration = const RendererDecoration(),
  this.availableButtons = ButtonRowType.values,
}) : super(key: key);