QuillEditorWidget class
A Quill.js rich text editor widget for Flutter Web.
This widget embeds a Quill.js editor via an iframe and provides bidirectional communication between Flutter and the JavaScript editor.
Simple Usage (No Controller)
When you don't need programmatic access, just use the callbacks:
QuillEditorWidget(
onContentChanged: (html, delta) {
print('Content changed: $html');
},
)
Using with Controller
When you need programmatic control, provide your own controller. You are responsible for disposing it:
class MyWidget extends StatefulWidget {
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
final _controller = QuillEditorController();
@override
void dispose() {
_controller.dispose(); // You manage the lifecycle
super.dispose();
}
void _insertText() {
_controller.insertText('Hello World!');
}
@override
Widget build(BuildContext context) {
return QuillEditorWidget(
controller: _controller,
onContentChanged: (html, delta) {
print('Content changed: $html');
},
);
}
}
Using with GlobalKey (Legacy)
final GlobalKey<QuillEditorWidgetState> _editorKey = GlobalKey();
QuillEditorWidget(
key: _editorKey,
onContentChanged: (html, delta) {
print('Content changed: $html');
},
)
// Access methods via key
_editorKey.currentState?.insertText('Hello');
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- QuillEditorWidget
Constructors
- QuillEditorWidget({Key? key, QuillEditorController? controller, double? width, double? height, void onContentChanged(String html, dynamic delta)?, VoidCallback? onReady, bool readOnly = false, String? initialHtml, dynamic initialDelta, String? placeholder, String? editorHtmlPath, String? viewerHtmlPath})
-
const
Properties
- controller → QuillEditorController?
-
Controller for programmatic access to the editor.
final
- editorHtmlPath → String?
-
Path to the editor HTML file. Defaults to EditorConfig.editorHtmlPath.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Height of the editor. If null, expands to fill parent.
final
- initialDelta → dynamic
-
Initial Delta content to load (JSON).
final
- initialHtml → String?
-
Initial HTML content to load.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onContentChanged → void Function(String html, dynamic delta)?
-
Callback when editor content changes.
final
- onReady → VoidCallback?
-
Callback when the editor is ready.
final
- placeholder → String?
-
Placeholder text when editor is empty.
final
- readOnly → bool
-
Whether the editor is read-only (viewer mode).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- viewerHtmlPath → String?
-
Path to the viewer HTML file. Defaults to EditorConfig.viewerHtmlPath.
final
- width → double?
-
Width of the editor. If null, expands to fill parent.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< QuillEditorWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited