ValueDecoration class
Draw value of the items on them. Use this only as ChartState.foregroundDecorations in order to be visible at all locations Exact alignment can be set with alignment
- Inheritance
-
- Object
- DecorationPainter
- ValueDecoration
- Annotations
-
- @Deprecated('Use [WidgetItemBuilder] instead if you want to decorate chart items with text')
Constructors
- ValueDecoration({TextStyle? textStyle, Alignment alignment = Alignment.topCenter, int listIndex = 0, ValueFromItem valueGenerator = defaultValueForItem, bool hideZeroValues = false, LabelFromItem? labelGenerator})
- Constructor for values decoration
Properties
- alignment → Alignment
-
Alignment of the text based on item
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideZeroValues → bool
-
final
- labelGenerator → LabelFromItem?
-
Generate a custom label that is used.
final
- listIndex → int
-
Index of list in items, this is used if there are multiple lists in the chart
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textStyle → TextStyle?
-
Style for values to use
final
- valueGenerator → ValueFromItem
-
final
Methods
-
animateTo(
DecorationPainter endValue, double t) → DecorationPainter -
Animate to next decoration state, each decoration should implement this.
This is just regular lerp function, but instead of static function where you pass start and
end state, here we start with current state and animate to
endValue
.override -
applyPaintTransform(
ChartState state, Size size) → Offset -
override
-
draw(
Canvas canvas, Size size, ChartState state) → void -
Draw decoration.
Decoration can be foreground or background decoration that will be drawn on the chart
decorations can ignore padding and can use whole available canvas to draw.
override
-
getRenderer(
ChartState state) → Widget -
inherited
-
initDecoration(
ChartState state) → void -
Init decoration is first thing called on decorations, it will pass current ChartState
so decoration can easily calculate needed stuff for their layout.
override
-
isSameType(
DecorationPainter other) → bool -
Used for animating, we just need to find matching type, don't actually check for equality since we want to animate
from one state to other. Some decorations may consider overriding this in case multiples are used
override
-
layoutSize(
BoxConstraints constraints, ChartState state) → Size -
override
-
marginNeeded(
) → EdgeInsets -
Get extra margin (not definable by the user). This makes sure that any decoration
that leaves original drawing window is not drawing outside of that window (This is not
enforced right now but it's unwanted behaviour)
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paddingNeeded(
) → EdgeInsets -
Get extra padding (not definable by user, calculated by decoration if needed). This makes sure
that decoration will fit with the chart in wanted area.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
makeTextPainter(
String value, double width, TextStyle? style, {bool hasMaxWidth = true}) → TextPainter -
Get default text painter with set
value
Helper for_paintText