Last active
February 10, 2019 06:59
-
-
Save mhassanist/4c65a25e679bf7ed1a721524a5626288 to your computer and use it in GitHub Desktop.
Basic Flutter app with a button that shows Toast without using MaterialApp
This file contains hidden or 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
import 'package:flutter/material.dart'; | |
import 'package:fluttertoast/fluttertoast.dart'; | |
void main() { | |
runApp(WidgetsApp( | |
builder: (context, int) { | |
return Container( | |
color: Colors.white, | |
child:Center( | |
child: RaisedButton( | |
onPressed: () { | |
Fluttertoast.showToast( | |
msg: "This is Center Short Toast", | |
toastLength: Toast.LENGTH_SHORT, | |
gravity: ToastGravity.BOTTOM, | |
timeInSecForIos: 1, | |
backgroundColor: Colors.red, | |
textColor: Colors.white, | |
fontSize: 16.0 | |
); | |
}, | |
child: Text( | |
'Hello, world 2!', | |
textDirection: TextDirection.ltr, | |
), | |
), | |
)); | |
}, | |
color: Colors.blue, | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment