onValueChanged property

  1. @override
ValueChanged<double>? onValueChanged
final

Called during a drag when the user is selecting a new value for the pointer by dragging.

The pointer passes the new value to the callback but does not actually change state until the parent widget rebuilds the pointer with the new value.

The callback provided to onValueChanged should update the state of the parent StatefulWidget using the State.setState method, so that the parent gets rebuilt; for example:

Widget build(BuildContext context) {
 return Container(
     child: SfRadialGauge(axes: <RadialAxis>[
   RadialAxis(
     pointers: <GaugePointer>[
       NeedlePointer(
           value: _currentValue,
           onValueChanged: (double newValue) {
             setState(() {
               _currentValue = newValue;
             });
           })
     ],
   )
 ]));
}

Implementation

@override
final ValueChanged<double>? onValueChanged;