LineTouchData constructor
- bool enabled = true,
- BaseTouchCallback<
LineTouchResponse> ? touchCallback, - MouseCursorResolver<
LineTouchResponse> ? mouseCursorResolver, - Duration? longPressDuration,
- LineTouchTooltipData touchTooltipData = const LineTouchTooltipData(),
- GetTouchedSpotIndicator getTouchedSpotIndicator = defaultTouchedIndicators,
- double touchSpotThreshold = 10,
- CalculateTouchDistance distanceCalculator = _xDistance,
- bool handleBuiltInTouches = true,
- GetTouchLineY getTouchLineStart = defaultGetTouchLineStart,
- GetTouchLineY getTouchLineEnd = defaultGetTouchLineEnd,
You can disable or enable the touch system using enabled
flag,
touchCallback
notifies you about the happened touch/pointer events.
It gives you a FlTouchEvent which is the happened event such as FlPointerHoverEvent, FlTapUpEvent, ...
It also gives you a LineTouchResponse which contains information
about the elements that has touched.
Using mouseCursorResolver
you can change the mouse cursor
based on the provided FlTouchEvent and LineTouchResponse
if handleBuiltInTouches
is true, LineChart shows a tooltip popup on top of the spots if
touch occurs (or you can show it manually using, LineChartData.showingTooltipIndicators)
and also it shows an indicator (contains a thicker line and larger dot on the targeted spot),
You can define how this indicator looks like through getTouchedSpotIndicator
callback,
You can customize this tooltip using touchTooltipData
, indicator lines starts from position
controlled by getTouchLineStart
and ends at position controlled by getTouchLineEnd
.
If you need to have a distance threshold for handling touches, use touchSpotThreshold
.
Implementation
const LineTouchData({
bool enabled = true,
BaseTouchCallback<LineTouchResponse>? touchCallback,
MouseCursorResolver<LineTouchResponse>? mouseCursorResolver,
Duration? longPressDuration,
this.touchTooltipData = const LineTouchTooltipData(),
this.getTouchedSpotIndicator = defaultTouchedIndicators,
this.touchSpotThreshold = 10,
this.distanceCalculator = _xDistance,
this.handleBuiltInTouches = true,
this.getTouchLineStart = defaultGetTouchLineStart,
this.getTouchLineEnd = defaultGetTouchLineEnd,
}) : super(
enabled,
touchCallback,
mouseCursorResolver,
longPressDuration,
);