CustomizableEditor constructor
- Key? key,
- bool showPreview = true,
- String? initialValue,
- int? maxLength,
- String placeholderMarker = "\\\$",
- List<
RichTextPlaceholder> placeholders = const [], - dynamic onChanged() = CustomizableEditor._doNothingWithResult,
- EditorDecoration editorDecoration = const EditorDecoration(),
- List<
String> availableColors = TextConstants.defaultColors, - bool alwaysShowButtons = true,
- CustomizableEditorController? controller,
- List<
Widget> ? additionalActionButtons, - bool autofocus = false,
- List<
ButtonRowType> availableButtons = ButtonRowType.values, - Widget builder(
- BuildContext context,
- Widget editor,
- Widget preview
- bool isHtmlPriview = true,
- FocusNode? focusNode,
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.
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 CustomizableEditor({
super.key,
this.showPreview = true,
this.initialValue,
this.maxLength,
this.placeholderMarker = "\\\$",
this.placeholders = const [],
this.onChanged = CustomizableEditor._doNothingWithResult,
this.editorDecoration = const EditorDecoration(),
this.availableColors = TextConstants.defaultColors,
this.alwaysShowButtons = true,
this.controller,
this.additionalActionButtons,
this.autofocus = false,
this.availableButtons = ButtonRowType.values,
this.builder,
this.isHtmlPriview = true,
this.focusNode,
});