Files
Remever/lib/common/toast.dart

38 lines
983 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Flutter imports:
import 'package:flutter/widgets.dart';
// Package imports:
import 'package:oktoast/oktoast.dart' show ToastPosition, showToastWidget;
import 'package:remever/common/resources.dart';
import 'package:remever/common/widgets/info_toast.dart';
// Project imports:
///
/// Класс для отображения тостов
///
final class Toast {
///
/// Показать информационный тост
///
static void show(Widget child, {Duration? duration}) {
showToastWidget(
InfoToast(child: child),
duration: duration,
handleTouch: true,
);
}
///
/// Показать тост с иконкой для закрытия
///
static void showDismissible(String message, {Duration? duration}) {
showToastWidget(
InfoToast.dismissible(message: message, bgColor: AppColors.white),
position: ToastPosition.top.copyWith(offset: 50),
duration: duration,
handleTouch: true,
);
}
}