GeekAbdelouahed / flutter-reaction-button

Flutter Reaction Button is a customizable Flutter package that allows you to easily create interactive buttons with reaction emojis, similar to Facebook's iconic reaction buttons.
https://pub.dev/packages/flutter_reaction_button
MIT License
215 stars 78 forks source link

Reaction box is showing off the screen. #33

Open jigarfumakiya opened 2 years ago

jigarfumakiya commented 2 years ago

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.

test_image

jigarfumakiya commented 2 years ago

@GeekAbdelouahed Any help would be appreciated. Thanks

rlee1990 commented 2 years ago

@GeekAbdelouahed I too am having the same issue but only on IOS.

jigarfumakiya commented 2 years ago

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);
  }
rlee1990 commented 2 years ago

@jigarfumakiya where is this located?

rlee1990 commented 2 years ago

NVM

rlee1990 commented 2 years ago

@GeekAbdelouahed what @jigarfumakiya suggested does indeed fix the issue.

jigarfumakiya commented 2 years ago

@jigarfumakiya where is this located?

Screenshot 2022-01-13 at 11 12 41 PM

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.

rlee1990 commented 2 years ago

@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.

rlee1990 commented 2 years ago

@GeekAbdelouahed any update on this?

wdcs-kishangohel commented 2 years ago

Same issue with 2.0.1 version

GeekAbdelouahed commented 1 year ago

@jigarfumakiya can you test this with version 3.0.0 or above?.

julek-kal commented 1 year ago

@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.