akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.37k stars 378 forks source link

Set MaxHeight relative to available space #105

Closed brizaldi closed 4 years ago

brizaldi commented 4 years ago

is it possible to set the MaxHeight of the panel the total available space that the panel can expand to. i.e. sliding panel as Expanded child

marchacio commented 4 years ago

is it possible to set the MaxHeight of the panel the total available space that the panel can expand to. i.e. sliding panel as Expanded child

You can get height of your screen: double height = MediaQuery.of(context).size.height And use it as maxHeight.

Remember that's possible get this code (double height = MediaQuery.of(context).size.height) only from the Build method of the Stateful/Stateless widget

I hope I have helped you

brizaldi commented 4 years ago

what if i want to use it inside tab bar with bottom navigation bar? because i want to set panel height to fill the space between appbar and bottom navigation bar

marchacio commented 4 years ago

You can wrap all widgets into a Column

Scaffold(
   appBar: null,
   bottomNavigationBar: null
   body: Column(
       mainAxisSize: MainAxisSize.max,
       children: [
         TabBar,

         Panel,

         BottomNavBar,
      ]
   )
)

honestly, I haven't tried if the code works, but it should do

akshathjain commented 4 years ago

@brizaldi There are flutter methods that allow you to get the preferred size of the bottom nav bars and app bars, so you can account for those using the method mentioned by @marchacio.