flutter-reaction-button icon indicating copy to clipboard operation
flutter-reaction-button copied to clipboard

Reaction box is showing off the screen.

Open jigarfumakiya opened this issue 3 years ago • 12 comments

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 avatar Jan 10 '22 16:01 jigarfumakiya

@GeekAbdelouahed Any help would be appreciated. Thanks

jigarfumakiya avatar Jan 10 '22 18:01 jigarfumakiya

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

rlee1990 avatar Jan 13 '22 16:01 rlee1990

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 avatar Jan 13 '22 17:01 jigarfumakiya

@jigarfumakiya where is this located?

rlee1990 avatar Jan 13 '22 17:01 rlee1990

NVM

rlee1990 avatar Jan 13 '22 17:01 rlee1990

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

rlee1990 avatar Jan 13 '22 17:01 rlee1990

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

jigarfumakiya avatar Jan 13 '22 17:01 jigarfumakiya

@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 avatar Jan 13 '22 19:01 rlee1990

@GeekAbdelouahed any update on this?

rlee1990 avatar Feb 21 '22 14:02 rlee1990

Same issue with 2.0.1 version

wdcs-kishangohel avatar Aug 08 '22 05:08 wdcs-kishangohel

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

GeekAbdelouahed avatar Oct 20 '23 08:10 GeekAbdelouahed

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

julek-kal avatar Oct 26 '23 02:10 julek-kal