Skip to content

Commit 5b29db9

Browse files
authored
Update SnackBar.onVisible documentation (#162448)
## Description This PR updated `SnackBar.onVisible` documentation to explain why it can be call several times. ## Related Issue Fixes [Snackbar onVisible is called twice](flutter/flutter#162377) ## Tests Documentation only
1 parent e0aae0d commit 5b29db9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,13 @@ class SnackBar extends StatefulWidget {
464464
final Animation<double>? animation;
465465

466466
/// Called the first time that the snackbar is visible within a [Scaffold].
467+
///
468+
/// When multiple [Scaffold]s are registered to the same [ScaffoldMessengerState],
469+
/// [onVisible] is called once for each scaffold.
470+
///
471+
/// See also:
472+
///
473+
/// * [ScaffoldMessenger], which manages [SnackBar]s for [Scaffold] descendants.
467474
final VoidCallback? onVisible;
468475

469476
/// The direction in which the SnackBar can be dismissed.

0 commit comments

Comments
 (0)