Skip to content

Commit ea9e175

Browse files
blerouxgspencergoog
authored andcommitted
Improve showSnackBar documentation (flutter#114612)
Co-authored-by: Bruno Leroux <[email protected]>
1 parent 5915442 commit ea9e175

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/flutter/lib/src/material/scaffold.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
244244

245245
// SNACKBAR API
246246

247-
/// Shows a [SnackBar] across all registered [Scaffold]s.
247+
/// Shows a [SnackBar] across all registered [Scaffold]s. Scaffolds register
248+
/// to receive snack bars from their closest [ScaffoldMessenger] ancestor.
249+
/// If there are several registered scaffolds the snack bar is shown
250+
/// simultaneously on all of them.
248251
///
249252
/// A scaffold can show at most one snack bar at a time. If this function is
250253
/// called while another snack bar is already visible, the given snack bar
@@ -432,7 +435,10 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
432435

433436
// MATERIAL BANNER API
434437

435-
/// Shows a [MaterialBanner] across all registered [Scaffold]s.
438+
/// Shows a [MaterialBanner] across all registered [Scaffold]s. Scaffolds register
439+
/// to receive material banners from their closest [ScaffoldMessenger] ancestor.
440+
/// If there are several registered scaffolds the material banner is shown
441+
/// simultaneously on all of them.
436442
///
437443
/// A scaffold can show at most one material banner at a time. If this function is
438444
/// called while another material banner is already visible, the given material banner
@@ -1559,6 +1565,12 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
15591565
/// app. A bottom sheet can either be persistent, in which case it is shown
15601566
/// using the [ScaffoldState.showBottomSheet] method, or modal, in which case
15611567
/// it is shown using the [showModalBottomSheet] function.
1568+
/// * [SnackBar], which is a lightweight message with an optional action which
1569+
/// briefly displays at the bottom of the screen. Use the
1570+
/// [ScaffoldMessengerState.showSnackBar] method to show snack bars.
1571+
/// * [MaterialBanner], which displays an important, succinct message, at the
1572+
/// top of the screen, below the app bar. Use the
1573+
/// [ScaffoldMessengerState.showMaterialBanner] method to show material banners.
15621574
/// * [ScaffoldState], which is the state associated with this widget.
15631575
/// * <https://material.io/design/layout/responsive-layout-grid.html>
15641576
/// * Cookbook: [Add a Drawer to a screen](https://flutter.dev/docs/cookbook/design/drawer)

0 commit comments

Comments
 (0)