Create a new Label.
The text of the label. Has the same behaviour as setting text.
Optional
properties: Readonly<LabelProperties>Protected
_dirtyWidget will only be painted if dirty is true.
Protected
_flexflex but for internal use.
Protected
_layoutIf this is true, widget needs their layout resolved. If implementing a container, propagate this up.
Protected
_parentProtected
_rootProtected
_viewportThe Viewport that this widget is currently painting to. A UI tree can have multiple Viewports due to ViewportWidget, so this is not equivalent to viewport.
Widgets not attached to a UI tree will have this property set to null.
Protected
heightHeight of widget in pixels.
Protected
idealThe ideal height of the widget in pixels. See width.
Protected
idealThe ideal width of the widget in pixels; if non-integer widget dimensions were allowed, the widget would have this size. Use this for layout calculations, but never use this for painting so that subpixel issues are avoided.
Protected
idealXThe ideal absolute horizontal offset of the widget in pixels; if non-integer positions were allowed, the widget would have this position. Use this for layout calculations, but never use this for painting so that subpixel issues are avoided.
Protected
idealYThe ideal absolute vertical offset of the widget in pixels. See x.
Readonly
needsWidget will have its background automatically cleared when painting if needsClear is true. The background fill style used is canvasFill.
Readonly
propagatesWidget will get targetted events even if the target is not itself if it this is true. Useful for implementing container widgets.
Protected
tabCan this widget be focused by pressing tab?
Protected
textThe helper for measuring/painting text
Protected
widthWidth of widget in pixels.
Is text wrapping enabled? If not, text will clipped on overflow
@layoutField
Protected
xAbsolute horizontal offset of widget in pixels.
Protected
yAbsolute vertical offset of widget in pixels.
The accent fill style. Usually a saturated colour more saturated than primaryFill used for highlighting boxes which use PrimaryFill.
The accent fill style. Usually a saturated colour more saturated than primaryFill used for highlighting boxes which use PrimaryFill.
Public getter for _active. Can only be updated by calling updateActiveState, although this should never be done manually; only done automatically by container Widgets and Roots.
Check if this Widget is attached to a UI tree. If not, then this Widget must not be used. Must not be overridden.
The background fill style. Used for widgets with a background (as in, a background above the canvas background).
The background fill style. Used for widgets with a background (as in, a background above the canvas background).
The background glow fill style. Used for highlighting boxes which use backgroundFill.
The background glow fill style. Used for highlighting boxes which use backgroundFill.
The blink rate of text cursors in text input widgets like TextInput. Value in "blinks" per second.
The blink rate of text cursors in text input widgets like TextInput. Value in "blinks" per second.
The default text alignment mode of body text (most regular text).
The default text alignment mode of body text (most regular text).
The fill style used for body text (most regular text).
The fill style used for body text (most regular text).
The font style used for body text (most regular text).
The font style used for body text (most regular text).
The height of each line of text in body text (most regular text). If null, it will be automatically detected.
The height of each line of text in body text (most regular text). If null, it will be automatically detected.
The spacing between each line of text in body text (most regular text). If null, it will be automatically detected.
The spacing between each line of text in body text (most regular text). If null, it will be automatically detected.
The canvas background fill style.
The canvas background fill style.
The alignment in Container for when there is extra space.
The alignment in Container for when there is extra space.
The thickness of a text cursor in pixels.
The thickness of a text cursor in pixels.
Get the resolved dimensions. Returns a 2-tuple containing width and height.
Use idealDimensions for layout calculations.
Check if the widget is dirty. Returns _dirty, as long as dimensionless is not true.
Is this widget enabled? If it isn't, it will act as if it doesn't exist.
If getting, _enabled is returned.
Protected
fallbackThe fallback theme. If this theme has a missing property, the fallback theme's property will be used instead. This will automatically (un)subscribe to/from the fallback theme.
How much this widget will expand relative to other widgets in a flexbox container. If changed, sets _layoutDirty to true.
Get the resolved ideal dimensions. Returns a 2-tuple containing idealWidth and idealHeight.
Use this for layout calculations, and dimensions for painting.
The inherited theme of this widget. Sets fallbackTheme.
The background fill style used for input widgets like TextInput.
The background fill style used for input widgets like TextInput.
The background fill style used for input widgets like TextInput when text is selected.
The background fill style used for input widgets like TextInput when text is selected.
The fill style used for text in input widgets like TextInput.
The fill style used for text in input widgets like TextInput.
The fill style used for text in input widgets like TextInput when disabled.
The fill style used for text in input widgets like TextInput when disabled.
The fill style used for text in input widgets like TextInput when invalid.
The fill style used for text in input widgets like TextInput when invalid.
The font style used for text in input widgets like TextInput.
The font style used for text in input widgets like TextInput.
The height of each line of text in input widgets like TextInput. If null, it will be automatically detected.
The height of each line of text in input widgets like TextInput. If null, it will be automatically detected.
The spacing between each line of text in input widgets like TextInput. If null, it will be automatically detected.
The spacing between each line of text in input widgets like TextInput. If null, it will be automatically detected.
Check if the widget's layout is dirty. Returns _layoutDirty.
The alignment in MultiContainer for when there is unused space.
The alignment in MultiContainer for when there is unused space.
The spacing length between widgets in MultiContainer.
The spacing length between widgets in MultiContainer.
Get the resolved position. Returns a 2-tuple containing x and y.
Use idealPosition for layout calculations.
The primary fill style. Usually a saturated colour used for filling boxes that need to stand out.
The primary fill style. Usually a saturated colour used for filling boxes that need to stand out.
Similar to checkboxInnerPadding, but for RadioButton.
Similar to checkboxInnerPadding, but for RadioButton.
Similar to checkboxLength, but for RadioButton.
Similar to checkboxLength, but for RadioButton.
The minimum length of the filled part of a ScrollableViewportWidget's scrollbar in percentage of total length.
The minimum length of the filled part of a ScrollableViewportWidget's scrollbar in percentage of total length.
The minimum length of the filled part of a ScrollableViewportWidget's scrollbar in pixels.
The minimum length of the filled part of a ScrollableViewportWidget's scrollbar in pixels.
The thickness of a ScrollableViewportWidget's scrollbar in pixels.
The thickness of a ScrollableViewportWidget's scrollbar in pixels.
The current text value.
Protected
activateCalled after the Widget is attached to a UI tree, its parent is
active (or Root is enabled if this is the top
Widget), and the Widget itself is enabled; only called when all of the
previous conditions are fulfilled, not when one of the conditions is
fulfilled. Should be overridden for resource management, but
super.activate
must be called.
Must not be propagated to children by container Widgets. This is already done automatically by updateActiveState.
Marks dirty and layoutDirty as true.
Called when the Widget is attached to a UI tree. Should only be
overridden by container widgets to attach children or for resource
management, but super.attach
must still be called.
If the widget is already in a UI tree (already has a parent or is the root Widget, both checked via attached), then this method will throw an exception; a Widget cannot be in multiple UI trees.
The Root of the UI tree
The Viewport in this part of the UI tree. A UI tree can have multiple nested Viewports due to ViewportWidget
The new parent of this Widget. If null
, then this Widget has no parent and is the root Widget
Auto-scroll to this widget. Uses the whole widget as the auto-scroll bounds.
Protected
clearPaiting utility: clears background of widget. Should not be overridden.
Rounds to nearest pixels; no subpixel clearing.
The background fill style used is canvasFill.
The fill style to use for clearing. If null (default), then the value of canvasFill is used
Protected
clearPaiting utility: end a clear operation (from clearStart). Should not be overridden.
The canvas fill rule for clipping. See the canvas clip documentation
Protected
clearPaiting utility: start a clear operation with no clipping path, the user has to add their own paths to the context. Should not be overridden.
The fill style to use for clearing. If null (default), then the value of canvasFill is used
Protected
deactivateCalled when the Widget is no longer active. Should be
overridden for resource management, but super.deactivate
must be
called.
Must not be propagated to children by container Widgets. This is already done automatically by updateActiveState.
Marks dirty and layoutDirty as true, and drops all foci set to this Widget if the Widget is attached.
Called when the Widget is detached from a UI tree. Should only be
overridden by container widgets to detach children or for resource
management, but super.detach
must still be called.
Sets _root, _viewport and _parent to null.
Drops all foci set to this Widget.
If the widget was not in a UI tree, then an exception is thrown.
Called when an event is passed to the Widget. Checks if the target matches the Widget, unless the Widget propagates events, or if the event is a PointerEvent and is in the bounds of the Widget. If neither of the conditions are true, the event is not captured (null is returned), else, the handleEvent method is called and its result is returned. Must not be overridden.
Returns the widget that captured the event or null if none captured the event.
Sets x, y, width and y from idealX, idealY, idealWidth and idealHeight by rounding them. If the final values have changed, _dirty is set to true.
Can be overridden, but super.finalizeBounds
must still be called; if
you have parts of the widget that can be pre-calculated when the layout
is known, such as the length and offset of a Checkbox, or
non-default dirty flags, such as backgroundDirty,
then this is the perfect method to override, since it's only called after
the layout is resolved to final (non-ideal) values, is only called if
needed (unlike postLayoutUpdate, which is always called after the
layout phase) and can be used to compare old and new positions and
dimensions.
Abstract container widgets such as Parent must always override
this and call finalizeBounds
on each child widget.
Force the widget to be fully re-painted and (by default) have layout resolved. For internal use only or for use by Parent widgets so that children get properly marked as dirty when added to a new container after reuse.
Should be overridden if the derived Widget has more dirty flags other
than the default ones (such as backgroundDirty),
but super.forceDirty
must be called.
Protected
handleWidget event handling callback. If the event is to be captured, the capturer is returned, else, null.
By default, this will do nothing and capture the event if it is targetted at itself.
If overriding, return the widget that has captured the event (could be
this
, for example, or a child widget if implementing a container), or
null if no widget captured the event. Make sure to not capture any events
that you do not need, or you may have unexpected results; for example, if
you capture all dispatched events indiscriminately, a TabSelect
event may be captured and result in weird behaviour when the user
attempts to use tab to select another widget.
Protected
handleWidget painting callback. By default does nothing. Do painting logic here when extending Widget. Even if _dirty is false, if this method is called, then the widget must still be painted. Should be overridden.
Was this widget force-painted? If calling a child's paint method, propagate this value
Protected
handleProtected
handleProtected
handleProtected
onCalled when the fallback theme changes. Does nothing by default.
The property name of the theme property that was updated. If a general theme update, then this will be null and all theme properties should be treated as changed.
Called when the Widget is dirty and the Root is being rendered. Does nothing if dirty flag is not set, else, clears the background if needsClear is true, calls the handlePainting method and unsets the dirty flag. Automatically calls dryPaint if dimensionless is true. Must not be overridden.
Force re-paint even if _dirty is false
Protected
paintPainting utility: paints a circle. Should not be overridden. Coordinates are relative to the center of the circle. Uses ctx's current fillStyle. Does not restore the context state after finishing.
Generic update method which is called after layout is resolved. Calls handlePostLayoutUpdate if widget is enabled. Must not be overridden.
Generic update method which is called before layout is resolved. Calls handlePreLayoutUpdate if widget is enabled. Must not be overridden.
Wrapper for handleResolveDimensions. Does nothing if _enabled is false. If the resolved dimensions change, _dirty is set to true. _layoutDirty is set to false. If the widget is not loose and the layout has non-infinite max constraints, then the widget is stretched to fit max constraints. Must not be overridden.
Like resolveDimensions but for widgets at the top of the widget tree (the child of the Root). This retries dimension resolving if there is at least one unconstrained axis so that flex layout works even in infinite layout.
Set the ideal position of this widget (idealX and idealY). Does not set any flags of the widget.
Can be overridden, but super.resolvePosition
must always be called, and
the arguments must be preserved. Container widgets should override this
method such that resolvePosition
is called for each child of the
container.
Update the active state of the Widget. If the active state
changes from false
to true
, then activate is called.
If the active state changes from true
to false
, then
deactivate is called.
Container Widgets must override this so that the active state of each
child is updated, but super.updateActiveState
must still be called.
Each child's active state must only be updated if the container's active
state changed; this is indicated by the return value of this method.
Returns true if the active state changed.
Generated using TypeDoc
A widget which displays a line of text.