showToast method

void showToast(
  1. FToast fToast,
  2. ToastType type,
  3. String message, {
  4. ToastGravity gravity = ToastGravity.BOTTOM,
  5. Duration duration = const Duration(seconds: 2),
})

Implementation

void showToast(FToast fToast, ToastType type, String message, {ToastGravity gravity = ToastGravity.BOTTOM, Duration duration = const Duration(seconds: 2)}) {
  final toastData = _toastData(type);
  Widget toast = Container(
      padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(25.0), color: toastData.a),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(toastData.b, color: toastData.c),
          const SizedBox(
            width: 12.0,
          ),
          Flexible(
            child: FittedBox(
              fit: BoxFit.scaleDown,
              child: Text(
                message,
                maxLines: 1,
                style: TextStyle(color: toastData.c),
              ),
            ),
          )
        ],
      ));
  fToast.showToast(
    child: toast,
    gravity: gravity,
    toastDuration: duration,
  );
}