From 467637718c6a1507e41ad4d606f4930528b436cb Mon Sep 17 00:00:00 2001 From: Md Didarul Islam Date: Sun, 23 Oct 2022 00:13:38 +0600 Subject: [PATCH] Replaced Scaffold.of(context) with ScaffoldMessenger.of(context) (#120) --- using_snackbar/lib/main.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/using_snackbar/lib/main.dart b/using_snackbar/lib/main.dart index 0e607044..f62b78a5 100644 --- a/using_snackbar/lib/main.dart +++ b/using_snackbar/lib/main.dart @@ -26,7 +26,7 @@ class MyButton extends StatelessWidget { // On pressing the raised button onPressed: () { // show snackbar - Scaffold.of(context).showSnackBar(SnackBar( + ScaffoldMessenger.of(context).showSnackBar(SnackBar( // set content of snackbar content: Text("Hello! I am SnackBar :)"), // set duration @@ -36,7 +36,7 @@ class MyButton extends StatelessWidget { label: "Hit Me (Action)", onPressed: () { // When action button is pressed, show another snackbar - Scaffold.of(context).showSnackBar(SnackBar( + ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( "Hello! I am shown becoz you pressed Action :)"), ));