ponnamkarthik / FlutterToast

Toast Plugin for Flutter
MIT License
1.43k stars 349 forks source link

Unable to pop up in web build release #493

Open jhembedded opened 5 months ago

jhembedded commented 5 months ago

My application runs on the web and can be used normally when debugging in a local browser. However, after compiling and distributing the version using

flutter build web release web extender canvas tree share icons

it cannot be used.

jhembedded commented 5 months ago

This is my usage:

enum ToastPosition {
  top,
  bottom,
  center,
  topLeft,
  topRight,
  bottomLeft,
  bottomFight,
  centerLeft,
  centerRight,
  snackbar,
  none,
}

  static showToast(String text,
      {ToastPosition position = ToastPosition.bottom}) async {
    if (!kIsWeb) {
      await Fluttertoast.cancel();
    }
    await Fluttertoast.showToast(
      gravity: ToastGravity.values[position.index],
      msg: text,
      backgroundColor: const Color.fromARGB(128, 50, 50, 50),
      textColor: Colors.white,
      webBgColor: "rgb(128 128 128 / 0.5)",
      webPosition: "center",
      webShowClose: false,
      timeInSecForIosWeb: 1,
    );
  }