Can I create something similar to Toasts in Flutter? Just a tiny notification window that is not directly in the face of the user and does not lock or fade the view behind i
Import the lib
fluttertoast: 3.1.3
Use like below
Fluttertoast.showToast(
msg: "Hello world",
textColor: Colors.white,
toastLength: Toast.LENGTH_SHORT,
timeInSecForIos: 1,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.indigo,
);
just use SnackBar(content: Text("hello"),) inside any event like onTap and onPress
you can read more about Snackbar here https://flutter.dev/docs/cookbook/design/snackbars
For the ones that are looking for a Toast
what can survive the route changes the SnackBar
might not be the best option.
Have a look at Overlay
instead.
https://api.flutter.dev/flutter/widgets/Overlay-class.html
You can use something like FlutterToast
Import the lib
fluttertoast: ^2.1.4
Use like below
Fluttertoast.showToast(
msg: "Hello world",
textColor: Colors.white,
toastLength: Toast.LENGTH_SHORT,
timeInSecForIos: 1,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.indigo,
);
Thats it..