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.38k stars 381 forks source link

Buttons inside sliding panel do not work #186

Closed Josephmaclean closed 4 years ago

Josephmaclean commented 4 years ago

I have a gesture detector in my collapsed panel which fires a panelcontroller.open() method. Once this is fired, none of the buttons in the panel work. if I hot reload it with the panel open, the buttons in the panel works but once I fire a panecontroller.close() method, the rest of the buttons in the collapsed panel does not work.

But somehow everything works if there's no Flex(Column or Row) widget in the panel and I don't know how to build a layout without one

  final PanelController _panelController = new PanelController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        key: _drawerKey,
        drawer: NavDrawer(),
        body: SlidingUpPanel(
          controller: _panelController,
          body: Center(child: Text("data"),),
          panel: _panel(),
          collapsed: _bottomSheet(),
          minHeight: 195,
          maxHeight: MediaQuery.of(context).size.height,
          borderRadius: Utils.panelRadius,
        ));
  }

  Widget _panel() {
    return Stack(
      overflow: Overflow.visible,
      children: [
        Container(
          child: Column(
            children: <Widget>[
              RaisedButton(
                child: Text("Open"),
                onPressed: () => _panelController.open(),
              ),
              RaisedButton(
                child: Text("Close"),
                onPressed: () => _panelController.close(),
              ),
              RaisedButton(
                child: Text("Show"),
                onPressed: () => _panelController.close(),
              ),
              RaisedButton(
                child: Text("Hide"),
                onPressed: () => _panelController.show(),
              ),
              TextField(
                decoration: Utils.inputDecoration(),
              )
            ],
          ),
        ),
      ],
    );
  }

  Widget _bottomSheet() {
    return Container(
        padding: EdgeInsets.fromLTRB(16, 8, 16, 32),
        color: Colors.white,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          mainAxisSize: MainAxisSize.max,
          children: [
            GestureDetector(
                onTap: () => _panelController.open(),
                child: TextField(
                  decoration: Utils.inputDecoration(),
                  onTap: () => _panelController.open(),
                  enabled: false,
                ))
          ],
        ));
  }
ziscloud commented 3 years ago

@Josephmaclean did you fixed this problem?

asa767 commented 3 years ago

Is there any solution. I have same issue.

rootd commented 2 years ago

I was also facing this issue.