Skip to content

Commit 4676377

Browse files
authored
Replaced Scaffold.of(context) with ScaffoldMessenger.of(context) (#120)
1 parent b0d917b commit 4676377

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

using_snackbar/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MyButton extends StatelessWidget {
2626
// On pressing the raised button
2727
onPressed: () {
2828
// show snackbar
29-
Scaffold.of(context).showSnackBar(SnackBar(
29+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
3030
// set content of snackbar
3131
content: Text("Hello! I am SnackBar :)"),
3232
// set duration
@@ -36,7 +36,7 @@ class MyButton extends StatelessWidget {
3636
label: "Hit Me (Action)",
3737
onPressed: () {
3838
// When action button is pressed, show another snackbar
39-
Scaffold.of(context).showSnackBar(SnackBar(
39+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
4040
content: Text(
4141
"Hello! I am shown becoz you pressed Action :)"),
4242
));

0 commit comments

Comments
 (0)