Use the Layout Builder for Responsive UI. The widget which was currently being built when the offending call was made was: The widget on which setState() or markNeedsBuild() was called was: Otherwise, the framework might not visit this widget during this build phase. As by declaring scaffold key to the scaffold of that page. This exception is allowedīuilds parent widgets before children, which means a dirty descendant will always be Only if one of its ancestors is currently building. A widget can be marked as needing to be built during How to open Scaffolds Drawer on page load 71. How to use drawer in Flutter without Scaffold 6. This Scaffold widget cannot be marked as needing to build because the framework is The default drawer in a Scaffold opens from left to right, is it possible to change the direction so it opens from the bottom up. SetState() or markNeedsBuild() called during build. Thus, there is no need to make the Drawer come in using a click on the drawer icon button in the app-bar. It disappears, when the properties inspector performs its save operation. The Drawer appears, then an item gets clicked. Somehow my ListTiles are in a different context to my Scaffold, so I have no access to the Navigator from there to close the Drawer. The error was The following assertion was thrown while notifying status listeners for My app uses a Drawer to present an item properties inspector by means of endDrawer. OnPressed: () => Scaffold.of(context).openDrawer(), Whenever one of the cards is tapped, the Navigation Drawer is opened and it should display the persons name and the count value. These cards each have a name and a counter value. But then there is the difficulty of animating in such a way to make it look nice and seems like a long winded solution. I have a Scaffold with a GridView of Cards in its body. My next thought is that I could possibly hide the navbar when the drawer opens and reveal it when the drawer is closed again. ? Container(color: Colors.red) //desktop screen Since flutter does not provide a side sheet modal, I am using the Navigation Drawer as a side sheet. as every time you change the width it rebuilds all the widget again Thanks for the help class HomePage extends StatelessWidget build(BuildContext context) ) Not Required Note that to get the context that includes the. But basically, when the user open the drawer then suddenly stretch the browser the drawer should closed.Ĭode below. If you also want to open it on a button press, you can use Scaffold.of(context).openDrawer() from your button. I have a code already that checked the screen width that show a button menu drawer or not. And I want to close the opened drawer on a specific screen width for mobile and desktop screen width, so if I stretch my browser, the drawer should close.įor example I opened the drawer (screen width less than 500)Īnd when the screen width is greater than 500, I want the opened drawer to automatically close.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |