import 'package:flutter/cupertino.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

class ToastUtil {
  ToastUtil._();

  static void showToast(String? msg,
      {Duration? displayTime,
      SmartToastType? displayType = SmartToastType.normal,
      bool? addPostFrame}) {
    if (msg != null) {
      if (addPostFrame == true) {
        WidgetsBinding.instance.addPostFrameCallback((_) {
          SmartDialog.showToast(msg,
              displayType: displayType, displayTime: displayTime);
        });
      } else {
        SmartDialog.showToast(msg,
            displayType: displayType, displayTime: displayTime);
      }
    }
  }
}
