Skip to content

Commit

Permalink
Replaced Scaffold.of(context) with ScaffoldMessenger.of(context) (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
islamdidarmd authored Oct 22, 2022
1 parent b0d917b commit 4676377
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions using_snackbar/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 :)"),
));
Expand Down

0 comments on commit 4676377

Please sign in to comment.