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

class ToastUtil {
  ToastUtil._();

  static int lengthShort = 2000;
  static int lengthLong = 3500;

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