DiagramProperty<S, T> class
final
One editable property of a subject: its key, label and group, how to read its value, the verb that sets it and how an inspector presents it.
S is the subject the property edits, such as ShapeElement,
ConnectorElement, an extension's options, ConnectorLabel or
DiagramTextSubject. T is the value type. A property applies wherever
the selection offers subjects of type S.
A property of an element, or of the selection, sets its value by
performing verb with args on the element, so the inspector changes a
diagram exactly as code and agents do. A property of a value inside an
element, such as a connector label or the text being formatted, or of
options, gives update instead: the owning element's verb, or
setOptions for options, applies the updated value.
Each factory pairs a value type with its presentation:
DiagramProperty.number<ShapeElement>(
'shape-corner-radius',
label: 'Corner radius',
group: DiagramPropertyGroup.style,
read: (shape) => shape.style.cornerRadius,
verb: 'setStyle',
args: (shape, radius) => {'cornerRadius': radius},
max: 48,
unit: 'px',
)
Properties
- group → DiagramPropertyGroup
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → DiagramIcon?
-
The icon an inspector shows for it, owned by the declaring extension.
final
- isWritable → bool
-
Whether the property changes subjects, rather than only showing them.
no setter
- key → String
-
Unique within one resolution.
final
- label → String
-
final
- presentation → DiagramPropertyPresentation
-
How an inspector presents the value.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueType → Type
-
The value type
T, by which an inspector chooses a custom editor.no setter - verb → String?
-
The verb that sets this property on an element or the selection.
final
Methods
-
accepts(
Object? subject) → bool -
Whether
subjectis something this property edits. -
args(
S subject, T value) → Map< String, Object?> -
The arguments of verb that set
valueonsubject. -
check(
T value) → String? -
Null when
valueis acceptable, otherwise the reason it is not. -
editLabel(
T value) → String -
The undo label for writing
value. -
hint(
T value) → String? - Guidance shown with the current value, if any.
-
isEnabled(
S subject) → bool -
isVisible(
S subject) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
S subject) → T -
same(
T a, T b) → bool - Whether two values are the same, for mixed-value detection.
-
summarize(
T value) → String -
Short text describing
value, for custom values without an editor. -
toString(
) → String -
A string representation of this object.
override
-
update(
S subject, T value) → S -
subjectwithvalue, for a property of a value, such as a label or the options, rather than of an element. -
withTypes<
R> (R use< A, B>(DiagramProperty< ) → RA, B> property) -
Calls
usewith this property's subject and value types, so code that holds a property of unknown types can still build typed values, such as a typed choice control.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
action<
S> (String key, {required String label, String? verb, Map< String, Object?> args(S subject)?, S update(S subject)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, DiagramIcon? icon, bool visible(S subject)?, bool enabled(S subject)?, String editLabel(Null value)?}) → DiagramProperty<S, Null> -
A command, such as "Clear formatting", shown as a button, or as an
icon button with an
icon. -
choice<
S, T> (String key, {required String label, required T read(S subject), required List< DiagramPropertyOption< options(S subject), String? verb, DiagramPropertyArgs<T> >S, T> ? args, S update(S subject, T value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, DiagramChoiceStyle style = DiagramChoiceStyle.swatches, bool labeled = true, bool visible(S subject)?, bool enabled(S subject)?, String? hint(T value)?, String? check(T value)?, String editLabel(T value)?}) → DiagramProperty<S, T> -
One of the
optionsa subject offers. An inspector draws each option by its value type, or shows its icon or label. -
color<
S> (String key, {required String label, required DiagramColor read(S subject), String? verb, DiagramPropertyArgs< S, DiagramColor> ? args, S update(S subject, DiagramColor value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, bool visible(S subject)?, bool enabled(S subject)?, String editLabel(DiagramColor value)?}) → DiagramProperty<S, DiagramColor> - A color with alpha.
-
custom<
S, T> (String key, {required String label, required T read(S subject), String? verb, DiagramPropertyArgs< S, T> ? args, S update(S subject, T value)?, bool equals(T a, T b)?, String summary(T value)?, String? check(T value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, DiagramIcon? icon, bool visible(S subject)?, bool enabled(S subject)?, String editLabel(T value)?}) → DiagramProperty<S, T> -
A value of type
Twhose editor an inspector chooses byT; without one it showssummary.equalscompares values for mixed selections; by default values compare with==. -
fill<
S> (String key, {required String label, required DiagramFill read(S subject), String? verb, DiagramPropertyArgs< S, DiagramFill> ? args, S update(S subject, DiagramFill value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, bool visible(S subject)?, bool enabled(S subject)?, String editLabel(DiagramFill value)?}) → DiagramProperty<S, DiagramFill> - No fill, a solid color, or a linear or radial gradient.
-
forValue<
S> (String key, ValueField field, {required String label, required Object? read(S subject), String? verb, DiagramPropertyArgs< S, Object> ? args, S update(S subject, Object value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, String unit = '', double? max, String editLabel(Object? value)?}) → DiagramProperty<Object?, Object?> -
The property that edits a value declared by
field, such as a shape's value or a route's option.readreturns the stored value andargsorupdatetake the value to store: booleans, numbers, ARGB integers for colors and strings, as the field stores them. A number field's bounds come from the field unlessmaxcaps them. -
number<
S> (String key, {required String label, required double read(S subject), String? verb, DiagramPropertyArgs< S, double> ? args, S update(S subject, double value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, double min = 0, double max = 1000000, double step = 1, String unit = '', int? precision, DiagramNumberStyle style = DiagramNumberStyle.stepper, (double, double) bounds(S subject)?, bool visible(S subject)?, bool enabled(S subject)?, String? check(double value)?, String editLabel(double value)?}) → DiagramProperty<S, double> -
A number between
minandmax, changed insteps.precisionsets the displayed decimal places; by default it followsstep.boundsnarrows the range for a subject. -
point<
S> (String key, {required String label, required DiagramPoint read(S subject), String? verb, DiagramPropertyArgs< S, DiagramPoint> ? args, S update(S subject, DiagramPoint value)?, (String, String) labels = ('X', 'Y'), DiagramPropertyGroup group = DiagramPropertyGroup.general, double min = -1000000, double max = 1000000, double step = 1, String unit = '', bool visible(S subject)?, bool enabled(S subject)?, String editLabel(DiagramPoint value)?}) → DiagramProperty<S, DiagramPoint> -
An x/y pair, labeled by
labels. -
size<
S> (String key, {required String label, required DiagramSize read(S subject), String? verb, DiagramPropertyArgs< S, DiagramSize> ? args, S update(S subject, DiagramSize value)?, (String, String) labels = ('W', 'H'), DiagramSize minimum = const DiagramSize(0, 0), double max = 1000000, double step = 1, String unit = '', (bool, bool) editable = (true, true), DiagramPropertyGroup group = DiagramPropertyGroup.general, bool visible(S subject)?, bool enabled(S subject)?, String editLabel(DiagramSize value)?}) → DiagramProperty<S, DiagramSize> -
A width/height pair of at least
minimum.editabledisables an axis. -
text<
S> (String key, {required String label, required String read(S subject), String? verb, DiagramPropertyArgs< S, String> ? args, S update(S subject, String value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, bool visible(S subject)?, bool enabled(S subject)?, String? check(String value)?, String editLabel(String value)?, int maxLines = 1, int? minLines}) → DiagramProperty<S, String> -
Text: a single line by default, or prose over
minLinestomaxLineslines whenmaxLinesis above one. -
toggle<
S> (String key, {required String label, required bool read(S subject), String? verb, DiagramPropertyArgs< S, bool> ? args, S update(S subject, bool value)?, DiagramPropertyGroup group = DiagramPropertyGroup.general, DiagramToggleStyle style = DiagramToggleStyle.standard, DiagramIcon? icon, bool visible(S subject)?, bool enabled(S subject)?, String editLabel(bool value)?}) → DiagramProperty<S, bool> -
On or off, presented by
style; a button or header toggle showsicon.