TF-1594 Use only one class TmailToast to display the message.

(cherry picked from commit 379c34b32b2e5c4dad141e6a98bdb92597fa6908)
This commit is contained in:
dab246
2023-03-16 18:23:47 +07:00
committed by Dat Vu
parent fe05df3477
commit 4e17813e1a
34 changed files with 752 additions and 930 deletions
@@ -1,5 +1,4 @@
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/utils/app_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_date_range_picker/multiple_view_date_range_picker.dart';
@@ -54,36 +53,26 @@ mixin DateRangePickerMixin {
DateTime? endDate,
{Function(DateTime? startDate, DateTime? endDate)? onCallbackAction}
) {
final _appToast = Get.find<AppToast>();
final _imagePaths = Get.find<ImagePaths>();
final appToast = Get.find<AppToast>();
if (startDate == null) {
_appToast.showToastWithIcon(
appToast.showToastErrorMessage(
context,
textColor: Colors.black,
message: AppLocalizations.of(context).toastMessageErrorWhenSelectStartDateIsEmpty,
icon: _imagePaths.icNotConnection
);
AppLocalizations.of(context).toastMessageErrorWhenSelectStartDateIsEmpty);
return;
}
if (endDate == null) {
_appToast.showToastWithIcon(
appToast.showToastErrorMessage(
context,
textColor: Colors.black,
message: AppLocalizations.of(context).toastMessageErrorWhenSelectEndDateIsEmpty,
icon: _imagePaths.icNotConnection
);
AppLocalizations.of(context).toastMessageErrorWhenSelectEndDateIsEmpty);
return;
}
if (endDate.isBefore(startDate)) {
_appToast.showToastWithIcon(
appToast.showToastErrorMessage(
context,
textColor: Colors.black,
message: AppLocalizations.of(context).toastMessageErrorWhenSelectDateIsInValid,
icon: _imagePaths.icNotConnection
);
AppLocalizations.of(context).toastMessageErrorWhenSelectDateIsInValid);
return;
}