HtmlEditorController class

Controller class for managing HTML editor operations with enhanced validation

Provides methods to interact with the HTML editor, including formatting, content management, editor state control, and form validation capabilities.

Constructors

HtmlEditorController()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

alignCenter() Future<void>
Align text center
alignLeft() Future<void>
Align text left
alignRight() Future<void>
Align text right
bold() Future<void>
Make selected text bold
clear() Future<void>
Clear all content
dispose() → void
Dispose resources
executeCommand(String command, [String? value]) Future<void>
Execute a formatting command
focus() Future<void>
Focus the editor
getCharacterCount() Future<int>
Get character count
getContentStats() Future<Map<String, dynamic>>
Get comprehensive content statistics
getHtml() Future<String>
Get the current HTML content
getLineCount() Future<int>
Get line count from HTML content
getText() Future<String>
Get plain text content
getWordCount() Future<int>
Get word count
hasContent() Future<bool>
Check if editor has content
indent() Future<void>
Indent text
insertBlockquote() Future<void>
Insert blockquote
insertCodeBlock() Future<void>
Insert code block
insertHorizontalRule() Future<void>
Insert a horizontal rule
insertHtml(String html) Future<void>
Insert HTML at the current cursor position
insertImage(String url, [String? alt]) Future<void>
Insert an image
Insert a link
insertOrderedList() Future<void>
Insert ordered list
insertTable(int rows, int columns) Future<void>
Insert a table
insertUnorderedList() Future<void>
Insert unordered list
italic() Future<void>
Make selected text italic
justify() Future<void>
Justify text
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outdent() Future<void>
Outdent text
redo() Future<void>
Redo the last undone action
removeFormat() Future<void>
Remove formatting
setBackgroundColor(String color) Future<void>
Set background color
setFontFamily(String fontFamily) Future<void>
Set font family
setFontSize(String size) Future<void>
Set font size
setHeading(int level) Future<void>
Set heading level (1-6)
setHtml(String html) Future<void>
Set the HTML content
setParagraph() Future<void>
Set paragraph format
setTextColor(String color) Future<void>
Set text color
setWidget(FlutterAdvancedHtmlEditorState widget) → void
Sets the widget instance for this controller
strikeThrough() Future<void>
Strike through selected text
toggleFullscreen() Future<void>
Toggle fullscreen mode
toString() String
A string representation of this object.
inherited
underline() Future<void>
Underline selected text
undo() Future<void>
Undo the last action
validate({bool required = false, int? minLength, int? maxLength, int? minLines, int? maxLines, String? customValidator(String content)?}) Future<String?>
Validates the content against specified requirements Returns null if valid, otherwise returns error message
validateContains(String requiredText, [String? message]) Future<String?>
Validates that content contains specific text
validateMaxLength(int maxLength, [String? message]) Future<String?>
Validates maximum character length
validateMaxLines(int maxLines, [String? message]) Future<String?>
Validates maximum line count
validateMinLength(int minLength, [String? message]) Future<String?>
Validates minimum character length
validateMinLines(int minLines, [String? message]) Future<String?>
Validates minimum line count
validateNotContains(String forbiddenText, [String? message]) Future<String?>
Validates that content does not contain specific text
validatePattern(RegExp pattern, [String? message]) Future<String?>
Validates that content matches a pattern
validateRequired([String? message]) Future<String?>
Validates content is not empty
validateWordCount({int? minWords, int? maxWords, String? message}) Future<String?>
Validates word count range

Operators

operator ==(Object other) bool
The equality operator.
inherited