![]() ![]() Perhaps this was the solution to the SnackBar in a Dialog problem? To save ourselves some time, unfortunately, it wasn't. When watching the Flutter Widget of the Week on ScaffoldMessenger I was excited to see that it sits above all Scaffolds in the hierarchy and came built into the MaterialApp widget. increment function triggered within the listener will double. I noticed however: upon every page refresh, there will be additional listeners causing double firing of events. You can see this in action if you position two Scaffolds on the same page and dispatch a SnackBar from one of them: I have a keyboard listener wrapping my Scaffold body to detect Enter and backspace key. ![]() BuildContext concontext final snackBar SnackBar(content: Text(message)) Scaffold.of(con). The main use case it seems to be trying to solve is synchronizing a SnackBar across navigation events. Inside Scaffold parent, you can do like below. Scaffold class Flutter 3.16.0 12:56 db7ef5bf9f stable API docs for the Scaffold constructor from Class Scaffold from the material library, for the Dart programming language. The same scaffold key needs to be passed down the Custom App Bar, where we trigger the alert dialog by pressing the person icon. So, we need to differentiate them with a unique key representing Scaffold State for each scaffold. Flutter 2.0 introduced ScaffoldMessenger as a replacement for displaying SnackBars directly from the Scaffold class. Scaffold is responsible for opening & closing a drawer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |