getPosition method
This method is to determine the position of the widget when dragged
Implementation
double getPosition() {
if (_position < 0) {
return 0;
} else if (_position > widget.width - widget.height) {
return widget.width - widget.height;
} else {
return _position;
}
}