flutter-reaction-button
flutter-reaction-button copied to clipboard
Reaction box is showing off the screen.
Great package.
I have added this package as my reaction button but sometimes it starts from the left and goes off the screen. I have tested it multiple times. Not see any exception in the console as well. I am attaching an image below
Take look.
@GeekAbdelouahed Any help would be appreciated. Thanks
@GeekAbdelouahed I too am having the same issue but only on IOS.
I tried to find out the issue but was not able to find out how and why this is happing.
But as of now as a quick fix, this works for me to change this method In reaction_box.dart
double _getHorizontalPosition() {
final buttonX = widget.buttonOffset.dx;
final buttonRadius = (widget.buttonSize.width / 2);
final screenWidth = MediaQuery
.of(context)
.size
.width;
if (buttonX + (_boxSizeAnimation.value?.width ?? 0) < screenWidth)
return buttonX - buttonRadius;
final value = buttonX + buttonRadius -
(_boxSizeAnimation.value?.width ?? 0);
//add this below code.
if (value.isNegative) {
return 20; // this is 20 horizontal width is fix you can play with it as you want.
}
return buttonX + buttonRadius - (_boxSizeAnimation.value?.width ?? 0);
}
@jigarfumakiya where is this located?
NVM
@GeekAbdelouahed what @jigarfumakiya suggested does indeed fix the issue.
@jigarfumakiya where is this located?
Check flutter_reaction_button
@rlee1990 FYI-:No I am not sure that it fixes the issue from the core. that is just a quick fix. If I get time will look into more details and send PR.
@jigarfumakiya from what I can see thats the right track. Im going to play around with it to find a way to have it centered.
@GeekAbdelouahed any update on this?
Same issue with 2.0.1 version
@jigarfumakiya can you test this with version 3.0.0
or above?.
@GeekAbdelouahed I've checked it on 3.0.0+2
and result wasn't satisfying( easily reproduceable by multiple presses and holds along horizontal axis )
So I've created #47. In my humble opinion now it's behave significantly better.
It would be nice if you can take a look and express your opinion. Additionally I've exposed positioningStrategy
which gave developers opportunity to manage reaction box position on theirs own.