InteractionTheme class
Defines the visual styling for interactive elements in charts.
This theme controls the appearance of:
- Crosshair lines that follow the cursor
- Crosshair coordinate labels (X/Y values)
- Tooltips that display data point information
- Selection highlights for data points and regions
Example:
final theme = InteractionTheme(
crosshairColor: Colors.grey,
crosshairWidth: 1.0,
crosshairDashPattern: [5.0, 3.0],
crosshairLabelStyle: LabelStyle(...),
tooltipStyle: LabelStyle(...),
selectionColor: Colors.blue.withOpacity(0.3),
);
- Available extensions
- Annotations
-
- @chartSurface
Constructors
-
InteractionTheme({required Color crosshairColor, required double crosshairWidth, required List<
double> crosshairDashPattern, Color crosshairBandColor = const Color(0x00000000), double crosshairBandWidth = 0, required LabelStyle crosshairLabelStyle, required LabelStyle tooltipStyle, required Color selectionColor}) -
const
-
InteractionTheme.fromJson(Map<
String, dynamic> json) -
factory
Properties
- crosshairBandColor → Color
-
Fill painted symmetrically around each active crosshair guide.
final
- crosshairBandWidth → double
-
Width of the guide band in logical pixels.
final
- crosshairColor → Color
-
Color of the crosshair lines.
final
-
crosshairDashPattern
→ List<
double> -
Dash pattern for crosshair lines.
Empty list means solid line. Non-empty list defines dash/gap pattern.
final
- crosshairLabelStyle → LabelStyle
-
Style for crosshair coordinate labels (X/Y values at chart edges).
final
- crosshairWidth → double
-
Width of the crosshair lines. Must be >= 0.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionColor → Color
-
Color used for selection highlights.
final
- tooltipStyle → LabelStyle
-
Style for data point tooltips (shown on marker hover).
final
Methods
-
copyWith(
{Color? crosshairColor, double? crosshairWidth, List< double> ? crosshairDashPattern, Color? crosshairBandColor, double? crosshairBandWidth, LabelStyle? crosshairLabelStyle, LabelStyle? tooltipStyle, Color? selectionColor}) → InteractionTheme -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
-
updateCrosshairLabelStyle(
LabelStyle update(LabelStyle current)) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Rebuilds InteractionTheme.crosshairLabelStyle from its current value. -
updateTooltipStyle(
LabelStyle update(LabelStyle current)) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Rebuilds InteractionTheme.tooltipStyle from its current value. -
withCrosshairBandColor(
Color value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.crosshairBandColor withvalue. -
withCrosshairBandWidth(
double value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.crosshairBandWidth withvalue. -
withCrosshairColor(
Color value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.crosshairColor withvalue. -
withCrosshairDashPattern(
List< double> value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.crosshairDashPattern withvalue. -
withCrosshairLabelStyle(
LabelStyle value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.crosshairLabelStyle withvalue. -
withCrosshairWidth(
double value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.crosshairWidth withvalue. -
withSelectionColor(
Color value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.selectionColor withvalue. -
withTooltipStyle(
LabelStyle value) → InteractionTheme -
Available on InteractionTheme, provided by the InteractionThemeFluent extension
Replaces InteractionTheme.tooltipStyle withvalue.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- colorblindFriendly → const InteractionTheme
- corporateBlue → const InteractionTheme
- defaultDark → const InteractionTheme
- defaultLight → const InteractionTheme
- highContrast → const InteractionTheme
- minimal → const InteractionTheme
- vibrant → const InteractionTheme