LabelContainer class

Container of one label anywhere on the chart, in Labels, Axis, Titles, etc.

The layoutSize is exactly that of by the contained layed out _textPainter (this LabelContainer has no margins, padding, or additional content in addition to the [_textPainter).

However, if this object is tilted, as specified by _labelTiltMatrix, the layoutSize is determined by the rotated layed out _textPainter. The math and layoutSize of this tilt is provided by _tiltedLabelEnvelope.

Most members are mutable so that clients can experiment with different ways to set text style, until the label fits a predefined allowed size.

Notes:

  • Instances manage the text to be presented as label, and create a member _textPainter, instance of widgets.TextPainter from the label. The contained _textPainter is used for all layout and painting.
  • All methods (and constructor) of this class always call _textPainter.layout immediately after a change. Consequently, there is no need to check for a "needs layout" method - the underlying _textPainter is always layed out, ready to be painted.
Implementers

Constructors

LabelContainer({required String label, required double labelMaxWidth, required Matrix2 labelTiltMatrix, required LabelStyle labelStyle})
Constructs an instance for a label, it's text style, and label's maximum width.

Properties

enableSkipOnDistressedSize bool
If size constraints imposed by parent are too tight, some internal calculations of sizes may lead to negative values, making painting of this container not possible.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isDistressed bool
getter/setter pairinherited
layoutSize Size
Manages the layout size during the layout process in layout. Should be only mentioned in this class, not super
getter/setter pairinherited
offset Offset
Current absolute offset, set by parent (and it's parent etc, to root).
getter/setter pairinherited
offsetOfPotentiallyRotatedLabel Offset
Offset of this LabelContainer's label, created by the _textPainter.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skipByParent bool
skipByParent instructs the parent container that this container should not be painted or layed out - as if it collapsed to zero size.
getter/setter pairinherited
tiltedLabelEnvelopeTopLeft Offset
Position where paint starts painting the label, expressed in the coordinate system in which this _tiltedLabelEnvelope.envelopeRect topLeft (NOT the _tiltedLabelEnvelope.topLeft) is at the origin.
no setter
tiltMatrix → Matrix2
Provides access to tiltMatrix for extension's paint methods.
no setterinherited

Methods

applyParentOffset(Offset offset) → void
Calls super method, then adds the passed offset to the locally-kept slot offsetOfPotentiallyRotatedLabel.
applyParentTiltMatrix(Matrix2 tiltMatrix) → void
Tilt may apply to the whole container. todo-2 unused? move to base class? similar to offset?
inherited
layout(LayoutExpansion parentLayoutExpansion) → void
Lays out this LabelContainer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas) → void
Implementor of method in superclass Container.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited