step method

bool step({
  1. required bool min,
  2. required bool expand,
})

Moves the active track on the min edge to the previous/next step.

Returns true when the caller should fire a tick haptic.

Implementation

bool step({required bool min, required bool expand}) {
  if (_value case final old? when old != (value = old.step(min: min, expand: expand))) {
    final (from, to) = min ? (old.pixels.min, value.pixels.min) : (old.pixels.max, value.pixels.max);
    for (final tick in _ticks) {
      if (_cross(from, tick, to)) {
        return true;
      }
    }
  }

  return false;
}