sliding_up_panel icon indicating copy to clipboard operation
sliding_up_panel copied to clipboard

Hide panel when collapsed

Open rienkkk opened this issue 4 years ago • 4 comments

I have a panel and a collapsed widget. When the panel goes to the collapsed state I would like to hide the content of the panel. Right now the panel content shows behind the collapsed widget. Does someone know how to do this?

rienkkk avatar Jan 06 '21 11:01 rienkkk

I am currently also looking into this. This @akshathjain seems to have done something similar #224 . @akshathjain any comments?

alestiago avatar Mar 15 '21 00:03 alestiago

It seems that if you set minHeight to 0, it will do the job. It is not the most elegant solution, but it is something.

alestiago avatar Mar 15 '21 00:03 alestiago

@alestiago I try with minHeight: 0 but the result was that my widget dissapear, can you tell me exactly your result with that solution

lasd14 avatar Apr 22 '22 14:04 lasd14

Hi, if someone have the need to hide the panel widget when the panel is closed, because at par you have a collapsed widget and you want to prevent these from overlapping, maybe this code will help you:

First in your Panel Widget you will need to wrap all the widget with a Visibility() and ask for a bool parameter. Second you will declare a bool variable and initialize in true or false. After this you need to have implemented a PanelController.

Okay now in your SlidingUpPanel widget you will use the function onPanelOpened() and onPanelClosed()

onPanelOpened: () { setState(() { visible = true; }); }, onPanelClosed: () { setState(() { visible = false; }); }, panel: _Panel(size: size, visible: visible),

Now when you use open the panel the state visible of the widget will be true and when then panel is closed the state will be false.

I know there may be better solutions for this, but this was the one that solved my problem. Any question can ask me.

Good Luck 🍟

lasd14 avatar Apr 22 '22 16:04 lasd14