Unverified Commit 000f4444 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Update ScaffoldMessenger docs for MaterialBanners (#89700)

* Update scaffold messenger docs for material banners

* Typos
parent 58944e6b
...@@ -59,19 +59,21 @@ enum _ScaffoldSlot { ...@@ -59,19 +59,21 @@ enum _ScaffoldSlot {
statusBar, statusBar,
} }
/// Manages [SnackBar]s for descendant [Scaffold]s. /// Manages [SnackBar]s and [MaterialBanner]s for descendant [Scaffold]s.
/// ///
/// This class provides APIs for showing snack bars. /// This class provides APIs for showing snack bars and material banners at the
/// bottom and top of the screen, respectively.
/// ///
/// To display a snack bar, obtain the [ScaffoldMessengerState] for the current /// To display one of these notifications, obtain the [ScaffoldMessengerState]
/// [BuildContext] via [ScaffoldMessenger.of] and use the /// for the current [BuildContext] via [ScaffoldMessenger.of] and use the
/// [ScaffoldMessengerState.showSnackBar] function. /// [ScaffoldMessengerState.showSnackBar] or the
/// [ScaffoldMessengerState.showMaterialBanner] functions.
/// ///
/// When the [ScaffoldMessenger] has nested [Scaffold] descendants, the /// When the [ScaffoldMessenger] has nested [Scaffold] descendants, the
/// ScaffoldMessenger will only present a [SnackBar] to the root Scaffold of /// ScaffoldMessenger will only present the notification to the root Scaffold of
/// the subtree of Scaffolds. In order to show SnackBars in the inner, nested /// the subtree of Scaffolds. In order to show notifications for the inner, nested
/// Scaffolds, set a new scope for your SnackBars by instantiating a new /// Scaffolds, set a new scope by instantiating a new ScaffoldMessenger in
/// ScaffoldMessenger in between the levels of nesting. /// between the levels of nesting.
/// ///
/// {@tool dartpad --template=stateless_widget_scaffold_center} /// {@tool dartpad --template=stateless_widget_scaffold_center}
/// Here is an example of showing a [SnackBar] when the user presses a button. /// Here is an example of showing a [SnackBar] when the user presses a button.
...@@ -83,6 +85,8 @@ enum _ScaffoldSlot { ...@@ -83,6 +85,8 @@ enum _ScaffoldSlot {
/// ///
/// * [SnackBar], which is a temporary notification typically shown near the /// * [SnackBar], which is a temporary notification typically shown near the
/// bottom of the app using the [ScaffoldMessengerState.showSnackBar] method. /// bottom of the app using the [ScaffoldMessengerState.showSnackBar] method.
/// * [MaterialBanner], which is a temporary notification typically shown at the
/// top of the app using the [ScaffoldMessengerState.showMaterialBanner] method.
/// * [debugCheckHasScaffoldMessenger], which asserts that the given context /// * [debugCheckHasScaffoldMessenger], which asserts that the given context
/// has a [ScaffoldMessenger] ancestor. /// has a [ScaffoldMessenger] ancestor.
/// * Cookbook: [Display a SnackBar](https://flutter.dev/docs/cookbook/design/snackbars) /// * Cookbook: [Display a SnackBar](https://flutter.dev/docs/cookbook/design/snackbars)
...@@ -165,10 +169,11 @@ class ScaffoldMessenger extends StatefulWidget { ...@@ -165,10 +169,11 @@ class ScaffoldMessenger extends StatefulWidget {
/// State for a [ScaffoldMessenger]. /// State for a [ScaffoldMessenger].
/// ///
/// A [ScaffoldMessengerState] object can be used to [showSnackBar] for every /// A [ScaffoldMessengerState] object can be used to [showSnackBar] or
/// registered [Scaffold] that is a descendant of the associated /// [showMaterialBanner] for every registered [Scaffold] that is a descendant of
/// [ScaffoldMessenger]. Scaffolds will register to receive [SnackBar]s from /// the associated [ScaffoldMessenger]. Scaffolds will register to receive
/// their closest ScaffoldMessenger ancestor. /// [SnackBar]s and [MaterialBanner]s from their closest ScaffoldMessenger
/// ancestor.
/// ///
/// Typically obtained via [ScaffoldMessenger.of]. /// Typically obtained via [ScaffoldMessenger.of].
class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProviderStateMixin { class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProviderStateMixin {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment