flutter-slide-to-act icon indicating copy to clipboard operation
flutter-slide-to-act copied to clipboard

Bugfix: calculation of _maxDx

Open AndrewSheetMetal opened this issue 2 years ago • 0 comments

I noticed that _maxDx was calculated quite complicated and wrong if you change properties that effect the size of the sliding button.

_maxDx = _containerWidth! -
          (sliderWidth / 2) -
          40 -
          widget.sliderButtonYOffset;

There is the hardcoded "40" and I noticed that sliderButtonYOffset (that should better be named sliderButtonXOffset ;) ) was just necessary because of a hardcoded horizontalPadding of 8 around the sliding button.

Therefore I did those changes and realized that the calculation of _maxDx becomes very simple:

_maxDx = _containerWidth! - sliderWidth;

AndrewSheetMetal avatar Jul 22 '22 09:07 AndrewSheetMetal