dragBehavior property

  1. @override
LinearMarkerDragBehavior dragBehavior
final

Specifies the drag behavior for shape marker pointer.

Defaults to LinearMarkerDragBehavior.free.

This snippet shows how to set drag behavior for a shape-pointer.

double _startMarkerValue = 30.0;
double _endMarkerValue = 60.0;

@override
Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text('Drag behavior'),
      ),
      body: SfLinearGauge(
        markerPointers: [
          LinearShapePointer(
            value: _startMarkerValue,
            dragBehavior: LinearMarkerDragBehavior.constrained,
            onChanged: (double value) {
              setState(() {
                _startMarkerValue = value;
              });
            },
          ),
          LinearShapePointer(
            value: _endMarkerValue,
            onChanged: (double value) {
              setState(() {
                _endMarkerValue = value;
              });
            },
          )
        ],
      ),
    ),
  );
}

Implementation

@override
final LinearMarkerDragBehavior dragBehavior;