RichTextEditor constructor Null safety
- {Key? key,
- TextStyle? labelTextStyle,
- bool showPreview = true,
- String? initialValue,
- int? maxLength,
- String placeholderMarker = "\\\$",
- List<
RichTextPlaceholder> placeholders = const [], - dynamic onChanged( ) = RichTextEditor._doNothingWithResult,
- EditorDecoration editorDecoration = const EditorDecoration(),
- List<
String> availableColors = TextConstants.defaultColors, - bool alwaysShowButtons = false,
- HtmlEditorController? controller,
- List<
Widget> ? additionalActionButtons, - bool animatePreviewToEditorPosition = true,
- bool autofocus = false,
- RendererDecoration previewDecoration = const RendererDecoration(),
- 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 RichTextEditor({
Key? key,
this.labelTextStyle,
this.showPreview = true,
this.initialValue,
this.maxLength,
this.placeholderMarker = "\\\$",
this.placeholders = const [],
this.onChanged = RichTextEditor._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 RendererDecoration(),
this.availableButtons = ButtonRowType.values,
}) : super(key: key);