-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request getters for _drawerOpened and _endDrawerOpened in Scaffold #23630
Comments
Using a custom DrawerController should allow you to do that. |
Thanks for that, (I also bookmarked https://flutter.io/support/) When I put
I get the same undesired tint screen, then drawer behavior as described above, hitting setDrawerOpen on the second swipe. (perhaps there are now two DrawerControllers?)
which has the expected drawer behavior, and hits the callback,but you can't put anything on the screen :( |
Sorry to hear. |
Hi,I want to you can try this. bool drawerOpen;
void setDrawerOpened(bool isOpen) {
drawerOpen = isOpen;
}
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: new DrawerWidget(
callback: setDrawerOpened,
),
);
}
class DrawerWidget extends StatefulWidget {
DrawerCallback callback;
DrawerWidget({this.callback});
@override
_DrawerWidgetState createState() => _DrawerWidgetState();
}
class _DrawerWidgetState extends State<DrawerWidget> {
@override
void initState() {
widget.callback(true);
super.initState();
}
@override
void dispose() {
widget.callback(false);
super.dispose();
}
@override
Widget build(BuildContext context) {
return Drawer(
child: Text("SS"),
);
}
}
|
For those googling in, there's now (v0.11.3) getters for isDrawerOpen and isEndDrawerOpen in scaffold.dart. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
So I have a use case for knowing when a drawer is open, and there are private scaffold variables that do what I need, seems a no brainer to add
or getters or whatever format is preferred.
Seems like it should be harmless and add value, but maintainer knows best.
Please consider.
The text was updated successfully, but these errors were encountered: