Slider<D> constructor

Slider<D>({
  1. SelectionTrigger? eventTrigger,
  2. SymbolRenderer? handleRenderer,
  3. dynamic initialDomainValue,
  4. String? roleId,
  5. SliderListenerCallback? onChangeCallback,
  6. bool snapToDatum = false,
  7. SliderStyle? style,
  8. int layoutPaintOrder = common.LayoutViewPaintOrder.slider,
})

Constructs a Slider.

eventTrigger sets the type of gesture handled by the slider.

handleRenderer draws a handle for the slider. Defaults to a rectangle.

initialDomainValue sets the initial position of the slider in domain units. The default is the center of the chart.

onChangeCallback will be called when the position of the slider changes during a drag event.

snapToDatum configures the slider to snap snap onto the nearest datum (by domain distance) when dragged. By default, the slider can be positioned anywhere along the domain axis.

style configures the color and sizing of the slider line and handle.

layoutPaintOrder configures the order in which the behavior should be painted. This value should be relative to LayoutPaintViewOrder.slider. (e.g. LayoutViewPaintOrder.slider + 1).

Implementation

factory Slider(
    {common.SelectionTrigger? eventTrigger,
    common.SymbolRenderer? handleRenderer,
    dynamic? initialDomainValue,
    String? roleId,
    common.SliderListenerCallback? onChangeCallback,
    bool snapToDatum = false,
    common.SliderStyle? style,
    int layoutPaintOrder = common.LayoutViewPaintOrder.slider}) {
  eventTrigger ??= common.SelectionTrigger.tapAndDrag;
  handleRenderer ??= common.RectSymbolRenderer();
  // Default the handle size large enough to tap on a mobile device.
  style ??= common.SliderStyle(handleSize: const Rectangle<int>(0, 0, 20, 30));
  return Slider._internal(
      eventTrigger: eventTrigger,
      handleRenderer: handleRenderer,
      initialDomainValue: initialDomainValue,
      onChangeCallback: onChangeCallback,
      roleId: roleId,
      snapToDatum: snapToDatum,
      style: style,
      desiredGestures: Slider._getDesiredGestures(eventTrigger),
      layoutPaintOrder: layoutPaintOrder);
}