From 5b29db924b92eef7390afb1165c8bfe6a014249f Mon Sep 17 00:00:00 2001 From: Bruno Leroux Date: Tue, 4 Feb 2025 14:29:29 +0100 Subject: [PATCH] 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](https://github.com/flutter/flutter/issues/162377) ## Tests Documentation only --- packages/flutter/lib/src/material/snack_bar.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 2bd072f469..eec7eb99c2 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -464,6 +464,13 @@ class SnackBar extends StatefulWidget { final Animation? animation; /// Called the first time that the snackbar is visible within a [Scaffold]. + /// + /// When multiple [Scaffold]s are registered to the same [ScaffoldMessengerState], + /// [onVisible] is called once for each scaffold. + /// + /// See also: + /// + /// * [ScaffoldMessenger], which manages [SnackBar]s for [Scaffold] descendants. final VoidCallback? onVisible; /// The direction in which the SnackBar can be dismissed.