computeNextValue function
Logoheadless

computeNextValue#

bool computeNextValue({ required double dragT, required double velocity, required bool isRtl, });

Computes the next switch value based on drag position and velocity.

dragT is the current 0..1 thumb position. velocity is the horizontal fling velocity in px/sec (positive = right). isRtl indicates right-to-left layout direction.

Returns the new switch value (true = on, false = off).

Logic (matches Flutter Switch):

  1. If velocity exceeds threshold → toggle based on velocity direction
  2. Otherwise → toggle based on position (>= 0.5 = on)