BubbleShowcase icon indicating copy to clipboard operation
BubbleShowcase copied to clipboard

Feat: better relative bubble positioning

Open Termtime opened this issue 4 years ago • 3 comments

Fixes Skyost/BubbleShowcase#16 This also supersedes part of the effort that #11 was doing, but I think a bit better, instead of declaring manually by how much you want the container to expand, we just let it automatically use the remainder of the parent's size in the direction that has the most space.

For this I added a new system that allows the expansion of the slide's child beyond the highlighted area, it is heavily assisted by an Align widget (or in the case of the example the SpeechBubble's NipLocation which sets an alignment). And its not possible to center the slide in the highlighted area when you are totally inside one of the quadrants of the screen, the only place where we kinda expand while keeping it centered is when we are not inside only one quadrant (also known as being in the center quadrant of the screen). I added a bunch of private helper functions inside RelativeBubbleSlide

To enable it you must set enableExtraSpace: true when declaring the RelativeBubbleSlide, this way it will be an opt-in change for previous users, and the previous system is still preserved and used by default.

Also modified the example to add showcases of the new system and how it looks.

LMK what you think @Skyost

Also, something that would be a breaking change is that previously that when you set direction: AxisDirection.right it would actually put the bubbleSlide to the left and vice-versa, I have fixed this, so it could break someone's BubbleShowcase, I would suggest moving a major version for the next release.

Termtime avatar Oct 14 '21 22:10 Termtime

LMK what you think @Skyost

Seems like a great idea, thanks for this PR 👍

Skyost avatar Oct 24 '21 08:10 Skyost

Great! I might finish this in the next week or two, I will tag you when I am done and open for review

Termtime avatar Oct 25 '21 00:10 Termtime

Fine 👍

Skyost avatar Oct 27 '21 20:10 Skyost