Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box Controller Drag update handle #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Raj217
Copy link

@Raj217 Raj217 commented Nov 8, 2023

Issue

I was working on my app which is a music app. As demonstrated in the example It opens the collapsed view by drag but when closing from the open state it was giving issue. This was because I gave the open height the full screen.

I then followed the example and tried to give 90% of the screen width. This gave me the access of some area above. I noticed that when I set draggableIconVisible as false on my opened body(panel) the drag was getting updated but it had some offset. Like the area just above it was used to drag the item down which was I suppose the area for the icon. I tried multiple ways, but maybe I was not able to dive deep enough to find a way if you have provided to it.

I gave a read to your source code and found a possible solution to it. I saw that there was a _onGestureUpdate and _onGestureEnd method which could be used in my case. I just exposed them with the help of BoxController and i was able to achieve the drag from externally. In my panel at the top I gave a inivisble Container of full width and height 40 and with that I was able to do the drag operation

Your source code is very readable and very well made thanks to that I was able to get to the solution very quickly.
I don't know if there is a solution to this but these few lines helped me and might help others.

@shirvanie
Copy link
Owner

Send your code to check.

@Raj217
Copy link
Author

Raj217 commented Nov 11, 2023

Sir code from my project?

If you want the code for my updated one it is in the files changed section here
Or the full code here

@shirvanie
Copy link
Owner

Just modify the following code in the music_player_screen.dart

Line 82: double maxHeightBox = MediaQuery.of(context).size.height - appBarHeight;
to : double maxHeightBox = MediaQuery.of(context).size.height;

and

Line 145: body: _body(height: maxHeightBox),
to: body: _body(height: maxHeightBox - 30),

@Raj217
Copy link
Author

Raj217 commented Nov 11, 2023

Thank you for the help!

@shirvanie
Copy link
Owner

you're welcome. no other problem? problem is solved?

@Raj217
Copy link
Author

Raj217 commented Nov 13, 2023

The problem actually was that the sliding window was actually covering the whole screen(according to my design) so the top part was not able to get the gesture.... I tried what you instructed but the problem was that it would be a bad UX for the user to able to hold a small part according to my design I wanted the user to give some room so I tried that with the flow I explained and gave this PR for

The whole screen is filled with the sliding panel(open) and on top there is a minimize button (arrow_down icon) and the whole region I placed an invisible container and on that I used gesture detector and with boxController.onGestureUpdate I did get the feel I wanted.... I just thought that some would want like me to use bit more customized and have a bit more control over the drag update

So now my screen is somewhat like
https://github.com/shirvanie/flutter_sliding_box/assets/63448767/4faba8ff-c2a3-4f60-a049-7903e3653826

@shirvanie
Copy link
Owner

shirvanie commented Nov 13, 2023

I did not understand what you did

Did you use the nest box?

Is your problem solved, if not write an example code for me to check.

@Raj217
Copy link
Author

Raj217 commented Nov 13, 2023

Ya my issue was resolved no worries. I just showed my desired action in the video above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants