LightHtmlRichTextEditor constructor

const LightHtmlRichTextEditor({
  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. void onChanged(
    1. String valueNew
    ) = LightHtmlRichTextEditor._doNothingWithResult,
  9. EditorDecoration editorDecoration = const EditorDecoration(),
  10. List<String> availableColors = TextConstants.defaultColors,
  11. bool alwaysShowButtons = false,
  12. LightHtmlEditorController? controller,
  13. List<Widget>? additionalActionButtons,
  14. bool animatePreviewToEditorPosition = true,
  15. bool autofocus = false,
  16. RendererStyle previewDecoration = const RendererStyle(),
  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

Implementation

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