setPositionByValue method
Sets the position of the ruler based on the provided value.
This method adjusts the ruler's position (such as the scroll offset or marker position) based on the given value (e.g., "kg", "cm", etc.). It is used to align the ruler visually to a specific value, ensuring that the ruler's display corresponds to the provided measurement.
Example: If the value is 5.0 and the ruler represents a scale for "kg", this method would adjust the ruler so that the position corresponding to 5 kg is aligned properly.
Implementation
void setPositionByValue(num value) {
double offsetValue = getPositionByValue(value);
scrollController.jumpTo(offsetValue);
fixOffset();
}