SfLegend class
Represents the class for legends.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SfLegend
Constructors
-
SfLegend({Key? key, required List<
LegendItem> ? items, bool shouldAlwaysShowScrollbar = false, Widget? title, Color? color, BorderSide? border, LegendPosition position = LegendPosition.top, LegendOverflowMode overflowMode = LegendOverflowMode.wrap, double spacing = 5.0, double itemSpacing = 10.0, double? itemRunSpacing, Size iconSize = const Size(8.0, 8.0), BorderSide? iconBorder, Axis? direction, Axis? scrollDirection, double? width, double? height, LegendAlignment? alignment = LegendAlignment.center, Offset? offset, EdgeInsetsGeometry? padding = const EdgeInsets.all(10.0), EdgeInsetsGeometry? margin, TextStyle? textStyle, ShapeMarkerType? iconType = ShapeMarkerType.circle, ImageProvider<Object> ? imageProvider, Color? toggledIconColor, double toggledTextOpacity = 0.5, ToggledIndicesChangedCallback? onToggledIndicesChanged, ItemRenderCallback? onItemRenderer, bool isComplex = false, List<int> ? toggledIndices, required Widget child}) -
Creates a SfLegend.
const
-
SfLegend.bar({Key? key, required List<
LegendItem> ? items, bool shouldAlwaysShowScrollbar = false, Widget? title, Color? color, BorderSide? border, LegendPosition position = LegendPosition.top, LegendOverflowMode overflowMode = LegendOverflowMode.scroll, double itemSpacing = 2.0, Axis? direction, Axis? scrollDirection, Offset? offset, EdgeInsetsGeometry? padding = const EdgeInsets.all(10.0), EdgeInsetsGeometry? margin, TextStyle? textStyle, Size? segmentSize, LegendLabelsPlacement? labelsPlacement, LegendEdgeLabelsPlacement? edgeLabelsPlacement = LegendEdgeLabelsPlacement.inside, LegendLabelOverflow? labelOverflow = LegendLabelOverflow.visible, LegendPaintingStyle? segmentPaintingStyle = LegendPaintingStyle.solid, bool isComplex = false, List<int> ? toggledIndices, LegendPointerBuilder? pointerBuilder, Size pointerSize = const Size(16.0, 12.0), Color? pointerColor, PointerController? pointerController, required Widget child}) -
Creates a SfLegend.
const
-
SfLegend.builder({Key? key, required int itemCount, required IndexedWidgetBuilder? itemBuilder, Widget? title, bool shouldAlwaysShowScrollbar = false, Color? color, BorderSide? border, Offset? offset, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, LegendPosition position = LegendPosition.top, LegendOverflowMode overflowMode = LegendOverflowMode.wrap, double itemSpacing = 10.0, double? itemRunSpacing, double spacing = 5.0, Axis? direction, Axis? scrollDirection, double? width, double? height, LegendAlignment? alignment = LegendAlignment.center, Color? toggledItemColor, ToggledIndicesChangedCallback? onToggledIndicesChanged, bool isComplex = false, List<
int> ? toggledIndices, required Widget child}) -
Creates a SfLegend.
const
Properties
- alignment → LegendAlignment?
-
Specifies the alignment of legend.
final
- border → BorderSide?
-
A border to draw surround the legend.
final
- child → Widget
-
Specifies the child.
final
- color → Color?
-
The color to fill in the background of the legend.
final
- direction → Axis?
-
Arranges the legend items in either horizontal or vertical direction.
final
- edgeLabelsPlacement → LegendEdgeLabelsPlacement?
-
Place the edge labels either inside or outside of the bar legend.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Specifies the height of legend.
final
- iconBorder → BorderSide?
-
Specifies border of the icon.
final
- iconSize → Size
-
Specifies the size of the legend icon.
final
- iconType → ShapeMarkerType?
-
Specifies the shape of the legend icon.
final
-
imageProvider
→ ImageProvider<
Object> ? -
Identifies an image.
final
- isComplex → bool
-
Avoid the legend rendering if its size is greater than its child.
final
- itemBuilder → IndexedWidgetBuilder?
-
Widget builder for legend items.
final
- itemCount → int
-
Specifies the item count.
final
- itemRunSpacing → double?
-
Specifies the cross axis run spacing for the wrapped elements.
final
-
items
→ List<
LegendItem> ? -
Specifies the legend items.
final
- itemSpacing → double
-
Specifies the space between the each legend items.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelOverflow → LegendLabelOverflow?
-
Trims or removes the legend text when it is overflowed from the
bar legend.
final
- labelsPlacement → LegendLabelsPlacement?
-
Place the labels either between the segments or on the segments.
final
- margin → EdgeInsetsGeometry?
-
Empty space outside the decoration.
final
- offset → Offset?
-
Places the legend in custom position.
final
- onItemRenderer → ItemRenderCallback?
-
Called every time while rendering a legend item.
final
- onToggledIndicesChanged → ToggledIndicesChangedCallback?
-
Callback on toggle index changed.
final
- overflowMode → LegendOverflowMode
-
Wraps or scrolls the legend items when it overflows.
final
- padding → EdgeInsetsGeometry?
-
Empty space inside the decoration.
final
- pointerBuilder → LegendPointerBuilder?
-
Returns a widget for the given value.
Pointer which is used to denote the exact color on the segment
for the hovered shape or bubble. The pointerBuilder will be called
when the user interacts with the shapes or bubbles i.e., while tapping in
touch devices and hovering in the mouse enabled devices.
final
- pointerColor → Color?
-
Set the pointer color for the pointer support in the bar legend.
final
- pointerController → PointerController?
-
Specifies the pointer controller.
final
- pointerSize → Size
-
Set the pointer size for the pointer support in the bar legend.
final
- position → LegendPosition
-
Positions the legend in the different directions.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollDirection → Axis?
-
Scroll the legend items in either horizontal or vertical direction.
final
- segmentPaintingStyle → LegendPaintingStyle?
-
Applies gradient or solid color for the bar segments.
final
- segmentSize → Size?
-
specifies the segment size in case of bar legend.
final
- shouldAlwaysShowScrollbar → bool
-
Toggles the scrollbar visibility.
final
- spacing → double
-
Specifies the space between the legend text and the icon.
final
- textStyle → TextStyle?
-
Customizes the legend item's text style.
final
- title → Widget?
-
Enables a title for the legends to provide a small note about the legends.
final
- toggledIconColor → Color?
-
Specifies the toggle item color.
final
-
toggledIndices
→ List<
int> ? -
Represents the toggled item indices.
final
- toggledItemColor → Color?
-
Specifies the toggle item's color. Applicable for vector builder.
final
- toggledTextOpacity → double
-
Specifies the toggle item's text color opacity.
final
- width → double?
-
Specifies the width of legend.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _SfLegendState -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited