showToastMessage static method

dynamic showToastMessage(
  1. String message, {
  2. int? gravity = old.Toast.center,
  3. int? duration,
  4. bool needForceShow = false,
})

因百度键盘导致Fluttertoast库toast无法弹出,故使用Toast

Implementation

static showToastMessage(
  String message, {
  int? gravity = old.Toast.center,
  int? duration,
  bool needForceShow = false, //是否要在游戏中展示
}) {
  ///游戏中,不显示APP内的toast,除非该路由本身调用
  if (needForceShow == false) {
    if (OverlayInit.shouldGiveupToastCheck != null) {
      bool shouldGiveup = OverlayInit.shouldGiveupToastCheck!();
      if (shouldGiveup == true) {
        return;
      }
    }
  }

  old.Toast.show(
    message,
    gravity: gravity,
    duration: duration,
  );
}