showToast static method

Future<bool?> showToast(
  1. String msg, {
  2. Toast toastLength = Toast.LENGTH_SHORT,
  3. int timeInSecForIosWeb = 1,
  4. ToastGravity gravity = ToastGravity.CENTER,
  5. Color? backgroundColor,
  6. Color textColor = Colors.white,
  7. double fontSize = 12.0,
})

自定义Toast

Implementation

static Future<bool?> showToast(
  String msg, {
  Toast toastLength = Toast.LENGTH_SHORT,
  int timeInSecForIosWeb = 1,
  ToastGravity gravity = ToastGravity.CENTER,
  Color? backgroundColor,
  Color textColor = Colors.white,
  double fontSize = 12.0,
}) {
  return Fluttertoast.showToast(
    msg: msg,
    toastLength: toastLength,
    timeInSecForIosWeb: timeInSecForIosWeb,
    gravity: gravity,
    backgroundColor: backgroundColor ?? Color.fromRGBO(0, 0, 0, 0.6),
    textColor: Colors.white,
    fontSize: fontSize,
  );
}