Created
January 11, 2020 04:19
-
-
Save bharathraj-e/8744b3c4922ee214a1954a898e9389ac to your computer and use it in GitHub Desktop.
A function to create snackbar in flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); | |
snackyBar(String content, GlobalKey<ScaffoldState> _scaffoldKey) { | |
final snackBar = SnackBar( | |
content: Text(content), | |
duration: const Duration(seconds: 2), | |
backgroundColor: Colors.lightBlue, | |
); | |
_scaffoldKey.currentState.showSnackBar(snackBar); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment