diff --git a/src/content/cookbook/design/snackbars.md b/src/content/cookbook/design/snackbars.md index 685e2a075a..8c8ce5c094 100644 --- a/src/content/cookbook/design/snackbars.md +++ b/src/content/cookbook/design/snackbars.md @@ -10,6 +10,8 @@ take place. For example, when a user swipes away a message in a list, you might want to inform them that the message has been deleted. You might even want to give them an option to undo the action. +![SnackBar Demo](/assets/images/docs/cookbook/snackbar.webp){:.site-mobile-screenshot} + In Material Design, this is the job of a [`SnackBar`][]. This recipe implements a snackbar using the following steps: @@ -22,8 +24,8 @@ This recipe implements a snackbar using the following steps: When creating apps that follow the Material Design guidelines, give your apps a consistent visual structure. In this example, display the `SnackBar` at the bottom of the screen, -without overlapping other important -widgets, such as the `FloatingActionButton`. +without overlapping other important widgets, +such as the `FloatingActionButton`. The [`Scaffold`][] widget, from the [material library][], creates this visual structure and ensures that important @@ -55,21 +57,21 @@ ScaffoldMessenger.of(context).showSnackBar(snackBar); ``` :::note -To learn more, watch this short Widget of the Week video on +To learn more, watch the following two-minute Widget of the Week video on the `ScaffoldMessenger` widget: - + ::: ## 3. Provide an optional action You might want to provide an action to the user when -the SnackBar is displayed. +the `SnackBar` is displayed. For example, if the user accidentally deletes a message, -they might use an optional action in the SnackBar to recover -the message. +an `action` in the `SnackBar` could allow recovering the message. -Here's an example of providing +Here's an example that provides an additional `action` to the `SnackBar` widget: @@ -88,7 +90,7 @@ final snackBar = SnackBar( ## Interactive example :::note -In this example, the SnackBar displays when a user taps a button. +In this example, the `SnackBar` displays when a user taps a button. For more information on working with user input, see the [Gestures][] section of the cookbook. ::: @@ -144,10 +146,11 @@ class SnackBarPage extends StatelessWidget { ``` [Gestures]: /cookbook/gestures +[material library]: {{site.api}}/flutter/material/material-library.html [`Scaffold`]: {{site.api}}/flutter/material/Scaffold-class.html [`SnackBar`]: {{site.api}}/flutter/material/SnackBar-class.html -[material library]: {{site.api}}/flutter/material/material-library.html