moveSliderToDomain method

void moveSliderToDomain(
  1. D domain, {
  2. num? measure,
  3. bool skipAnimation = true,
})

Programmatically moves the slider to the location of domain on the domain axis and iff measure is set moves it also to its position along the primary measure axis.

If domain exists beyond either edge of the draw area, the position will be bound to the nearest edge of the chart. The slider's current domain value state will reflect the domain value at the edge of the chart. For ordinal axes, this might result in a domain value whose range band is partially located beyond the edge of the chart.

This does nothing if the domain matches the current domain location.

SliderEventListener callbacks will be fired to indicate that the slider has moved.

skipAnimation controls whether or not the slider will animate. Animation is disabled by default.

measure controls the vertical position of the handle on the measure axis, can only be set if the SliderHandlePosition is set to 'manual'. If measure exists beyond the edges of the draw area, the position will be bound to the nearest edge of the chart.

Implementation

void moveSliderToDomain(D domain, {num? measure, bool skipAnimation = true}) {
  // Nothing to do if we are unattached to a chart or asked to move to the
  // current location.
  if (_chart == null || domain == _domainValue) {
    return;
  }

  final positionChanged = _moveSliderToDomain(domain, measure: measure);

  if (positionChanged) {
    _dragStateToFireOnPostRender = SliderListenerDragState.end;

    _chart!.redraw(skipAnimation: skipAnimation, skipLayout: true);
  }
}