mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 20:03:46 +00:00
refactor: common message dialog method
This commit is contained in:
1 parent
7fdba12376
commit
f42838810a
15 files changed
+47
-22
No files matched your search
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user