forked from eatvio/eatvio_app
54 lines
1.3 KiB
Dart
54 lines
1.3 KiB
Dart
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
const int _toastDuration = 2;
|
|
|
|
void showInfoToast(String message) {
|
|
Fluttertoast.showToast(
|
|
msg: message,
|
|
toastLength: Toast.LENGTH_SHORT,
|
|
gravity: ToastGravity.TOP,
|
|
timeInSecForIosWeb: _toastDuration,
|
|
backgroundColor: appTheme.blueA400,
|
|
textColor: appTheme.whiteA700,
|
|
fontSize: 16.0,
|
|
);
|
|
}
|
|
|
|
void showErrorToast(String message) {
|
|
Fluttertoast.showToast(
|
|
msg: message,
|
|
toastLength: Toast.LENGTH_LONG,
|
|
gravity: ToastGravity.CENTER,
|
|
timeInSecForIosWeb: _toastDuration,
|
|
backgroundColor: appTheme.red,
|
|
textColor: Colors.white,
|
|
fontSize: 16.0,
|
|
);
|
|
}
|
|
|
|
void showSuccessToast(String message) {
|
|
Fluttertoast.showToast(
|
|
msg: message,
|
|
toastLength: Toast.LENGTH_SHORT,
|
|
gravity: ToastGravity.CENTER,
|
|
timeInSecForIosWeb: _toastDuration,
|
|
backgroundColor: appTheme.greenA70001,
|
|
textColor: appTheme.whiteA700,
|
|
fontSize: 16.0,
|
|
);
|
|
}
|
|
|
|
void showInternetConnectionToast() {
|
|
Fluttertoast.showToast(
|
|
msg: 'Проверьте подключение к интернету',
|
|
toastLength: Toast.LENGTH_LONG,
|
|
gravity: ToastGravity.TOP,
|
|
timeInSecForIosWeb: 3,
|
|
backgroundColor: appTheme.red,
|
|
textColor: Colors.white,
|
|
fontSize: 16.0,
|
|
);
|
|
}
|