DVStudioEditorController class
Editing state for one page document: what is selected, what changed, and how to undo it.
Every mutation goes through here rather than through DVPageDocumentEditor directly, because an editor without undo is not an editor — a mis-drop that cannot be reversed loses work.
- Inheritance
-
- Object
- ChangeNotifier
- DVStudioEditorController
Constructors
- DVStudioEditorController(DVPageDocument document, {int historyLimit = 100, bool readOnly = false})
Properties
- canRedo → bool
-
no setter
- canUndo → bool
-
no setter
- document → DVPageDocument
-
no setter
-
edits
→ Stream<
DVStudioEdit> -
Every mutation this controller performs, as data another controller can
apply. Edits applied from elsewhere are not republished, or two
collaborators would echo each other forever.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- historyLimit → int
-
How many snapshots to keep. Deep enough for a working session, bounded
so a long edit cannot grow without limit.
final
-
publisher
↔ Future<
void> Function(DVPageDocument document)? -
Where save sends the document, when not the page store.
getter/setter pair
- readOnly ↔ bool
-
A read-only controller refuses local mutations with a StateError but
still applies edits from elsewhere: a viewer's screen follows the
editors without getting to type. Settable, because the screen creates
the controller and whatever attaches to it decides who may edit.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedId → String?
-
The selected node, or null when nothing is selected.
no setter
- selectedNode → DVPageNode?
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
apply(
DVStudioEdit edit) → void - Performs an edit made elsewhere.
-
copy(
String id) → void -
Ctrl+C:
idis kept to be pasted. -
cut(
String id) → void -
Ctrl+X:
idis kept to be pasted, and taken off the page. -
dispose(
) → void -
Discards any resources used by the object.
override
-
duplicate(
String id) → void -
Copies the element
idand places the copy right after it, in the same container, with fresh ids all the way down, and selects the copy. This is Ctrl+D (Cmd+D). -
group(
String id) → void -
Ctrl+G:
idgoes into a new column where it was, and the column is selected -- Figma's group, as a box that lays out what is in it. -
insert(
DVPageNode node, {required String parent, int? index}) → void -
Inserts
nodeunderparent. This is a drop from the palette. -
move(
String id, {required String parent, int? index}) → void - Reparents a node. This is a drag between containers.
-
moveBy(
String id, int delta) → void -
Ctrl+] and Ctrl+[:
idone place later or earlier among what it sits beside. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
paste(
) → void - Ctrl+V: a copy of what was copied, after the selection -- or into it, when the selection holds children -- or at the end of the page.
-
redo(
) → void -
remove(
String id) → void -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
save(
) → Future< void> - Persists the document, which publishes it -- or hands it to publisher, which decides.
-
select(
String? id) → void -
selectFirstChild(
) → void - Enter: the first thing in the selection.
-
selectParent(
) → void - Shift+Enter: what the selection is in.
-
selectSibling(
int delta) → void - Tab and Shift+Tab: the next or previous element beside the selection.
-
setAction(
String id, Map< String, Object?> ? action) → void - Binds an action to a node, or clears it with null.
-
setProperty(
String id, String name, Object? value) → void - Sets one property on the selected node — the inspector's common case.
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void -
ungroup(
String id) → void -
Ctrl+Shift+G: what
idholds takes its place, andidgoes. -
update(
String id, DVPageNode transform(DVPageNode node)) → void - Replaces a node. This is the property inspector.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited