rIIh / expandable-bottom-bar

Expandable bottom app bar widget for Flutter SDK
MIT License
108 stars 27 forks source link

How to close expanded body on main body tap? #9

Closed nidhi1612 closed 4 years ago

nidhi1612 commented 4 years ago

Hello,

I am new to flutter. I have used expanded bottom app bar, i want to close the expanded body when user taps in the outside area. However i dont know how it can be done.

What exactly should be detected in order to close the pulled up expanded bottom bar?

arnemolland commented 4 years ago

You could add a GestureRecognizer to the outside area, and call close on your BottomBarController, for example:

DefaultBottomBarController(
  child: Scaffold(
    body: GestureDetector(
      onTap: DefaultBottomBarController.of(context).close,
      ... 
    ),
    bottomNavigationBar: BottomExpandableAppBar(
    ... 
    ),
  ),
);
rIIh commented 4 years ago

Closing. Good answer provided