Sunil Sharma
Sunil Sharma

Reputation: 43

Close the Drawer on Tap ListTile

Want that onTap ListTile of Drawer,drawer closed.

I have used Navigation.pop(context) but it pop whole screen. I have a CustomScaffold with global key.

Upvotes: 0

Views: 419

Answers (1)

Hardik Kumbhani
Hardik Kumbhani

Reputation: 2021

You can put this code in any onpressed event and you will get a solution.

onPressed: () {
      if (_scaffoldKey.currentState.isDrawerOpen)
        _scaffoldKey.currentState.openEndDrawer();
      else {
        _scaffoldKey.currentState.openDrawer();
      }
    },

Upvotes: 1

Related Questions