refactor: common message dialog method

This commit is contained in:
liwei committed 2023-03-06 21:02:24 +08:00
1 parent 7fdba12376
commit f42838810a
15 files changed
+47 -22

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import 'package:get/get.dart';
import '../api/model/result.dart';
void showErrorMessage(msg) {
final title = 'error'.tr;
if (msg is Result) {
Get.snackbar(title, msg.msg!);
return;
}
if (msg is Exception && (msg as dynamic).message is Result) {
Get.snackbar(title, ((msg as dynamic).message as Result).msg!);
return;
}
Get.snackbar(title, msg);
}
void showMessage(title, msg) {
Get.snackbar(title, msg);
}