Describe the bug
I trying to use a buttom to extend the panel using PanelController.open() function in a FlatButtom but does not work when im using the panelBuilder on it ... When i use a body instead of a panelBuilder it works...
If the isDraggable is setted as false and i using the panelBuilder it works too.
(Sorry for my bad english)
To Reproduce
Steps to reproduce the behavior:
Create a Widget SlidingUpPanel and wrap it in a StatefulWidget.
Pass a panelBuilder "panelBuilder: (ScrollController sc) => _scrollingList(sc),"
Pass a PanelController.
Set isDraggable as True
Set defaultPanelState as PanelState.CLOSED
In the Widget that returns _scrollingList() wrap a GridView.builder or ListView.builder on a Stack
Create in front of ListView.builder or GridView.builder a Container with a FlatButton inside
On the onPressed() function ;
if (widget.panelController.isPanelClosed) { setState(() { print("Open Panel"); widget.panelController.open(); }); } else { setState(() { print("Close Panel"); widget.panelController.close(); }); }
20 Put your StatefullWidget with the SlidingUpPanel inside on your body of the Scaffold
Compile
Try using the Flatbutton that is suposed to close and open the panel.
Expected behavior
Im expect to open and close the panel when i tap the flatbutton but only close it
Smartphone (please complete the following information):
Describe the bug I trying to use a buttom to extend the panel using PanelController.open() function in a FlatButtom but does not work when im using the panelBuilder on it ... When i use a body instead of a panelBuilder it works...
If the isDraggable is setted as false and i using the panelBuilder it works too.
(Sorry for my bad english)
To Reproduce Steps to reproduce the behavior:
if (widget.panelController.isPanelClosed) { setState(() { print("Open Panel"); widget.panelController.open(); }); } else { setState(() { print("Close Panel"); widget.panelController.close(); }); }
20 Put your StatefullWidget with the SlidingUpPanel inside on your body of the ScaffoldExpected behavior Im expect to open and close the panel when i tap the flatbutton but only close it
Smartphone (please complete the following information):
return SlidingUpPanel( collapsed: widget.panelCollapsed, isDraggable: widget.menuIsDraggable, panelBuilder: (ScrollController sc) => _scrollingList(sc), backdropEnabled: false, onPanelClosed: widget.onPanelClosed, onPanelOpened: widget.onPanelOpened, onPanelSlide: widget.onPanelSlide, snapPoint: widget.snapPoint, boxShadow: <BoxShadow>[ BoxShadow( color: Colors.black38.withOpacity(0.2), blurRadius: 1.0, // has the effect of softening the shadow spreadRadius: 0.2, // has the effect of extending the shadow offset: Offset( 0.0, // horizontal, move right 10 -1.3, // vertical, move down 10 ), ), ], defaultPanelState: widget.defaultPanelState, controller: widget.panelController, margin: MediaQuery.of(context).size.width > 800 ? EdgeInsets.only(left: 23, right: 23) : null, minHeight: widget.minHeight != null ? widget.minHeight : 160, maxHeight: widget.maxHeight != null ? widget.maxHeight : MediaQuery.of(context).size.height - 255, padding: EdgeInsets.only(left: 10, right: 10, top: 0), borderRadius: BorderRadius.only( topLeft: Radius.circular(28), topRight: Radius.circular(28)), body: widget.body, ); }
Widget _scrollingList(ScrollController sc) { final Orientation orientation = MediaQuery.of(context).orientation; return MediaQuery.removePadding( context: context, removeTop: true, child: Stack( children: <Widget>[ GridView.builder( shrinkWrap: true, physics: BouncingScrollPhysics(), controller: sc, itemCount: 50, padding: EdgeInsets.only(top: 50), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( childAspectRatio: (orientation == Orientation.portrait) ? (28 / 36) : (32 / 25), crossAxisSpacing: 10, mainAxisSpacing: 18, crossAxisCount: (orientation == Orientation.portrait) ? 3 : 4, ), itemBuilder: (BuildContext context, int i) { return Container( child: ItemMenuTid( onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) => TestPage()), ); }, ), ); }, ), Container( width: double.infinity, alignment: Alignment.topCenter, child: Container( height: 35, child: FlatButton( onPressed: () { if (widget.panelController.isPanelClosed) { setState(() { widget.panelController.animatePanelToPosition(1); }); } else { setState(() { widget.panelController.close(); }); } }, child: Container( decoration: BoxDecoration( color: Colors.black26, borderRadius: BorderRadius.circular(10), ), height: 4, width: 30, ), ), ), ), ], ), ); }
UPDATES: Im trying to debug a panel, so im made this.The panel keep in the Animating state when are open or closed... I dont know why
Probably is for this what the buttom does not work