CrdtTextFieldBuilder class
Binds a TextEditingController to the text handler registered under id
(CRDTTextHandler or CRDTFugueTextHandler), the way collaborative
editor bindings (e.g. Yjs) do:
- Local edits are pushed into the handler immediately, as the precise TextDelta of each editing gesture (common prefix/suffix trimming — no full-text diff, no debounce). Multi-op gestures run in a single transaction, so each gesture emits one document update.
- IME composition is respected: while a composing region is active (CJK input, autocorrect) nothing is committed; the accumulated delta is pushed when composition ends.
- Remote changes are adopted into the controller in place, with the
caret and selection kept visually anchored. With a
CRDTFugueTextHandlerthe anchor is a stable position (CRDTFugueTextHandler.stablePositionAt) tied to the identity of the element left of the caret — exact even when a remote change touches several regions at once; otherwise the offsets are mapped through the remote TextDelta, best-effort. - The subtree never rebuilds: the widget listens to the document directly and updates the controller, exactly like a headless editor binding. builder runs once.
Example
CrdtTextFieldBuilder(
id: 'note',
builder: (context, controller) => TextField(controller: controller),
),
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CrdtTextFieldBuilder
Constructors
- CrdtTextFieldBuilder({required String id, required Widget builder(BuildContext context, TextEditingController textEditingController), void onSelectionAnchorsChanged(FugueElementID? base, FugueElementID? extent)?, Key? key})
-
Create a CrdtTextFieldBuilder.
const
Properties
- builder → Widget Function(BuildContext context, TextEditingController textEditingController)
-
Called once with the TextEditingController internally handled.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The id of the text handler to bind (as registered on the document).
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onSelectionAnchorsChanged → void Function(FugueElementID? base, FugueElementID? extent)?
-
Called whenever the stable anchors of the local selection change
(
CRDTFugueTextHandler.stablePositionAtof the selection base and extent) — ready to be published as ephemeral presence (e.g. the awareness plugin ofcrdt_socket_sync), so that other peers can draw this user's cursor withCrdtTextCursorsOverlay.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CrdtTextFieldBuilder> -
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