mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 03:27:39 +08:00
separate api calls
This commit is contained in:
@@ -31,4 +31,14 @@ class Utils {
|
||||
static showSnakeBar(BuildContext context, String msg) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
||||
}
|
||||
|
||||
static bool showError(BuildContext context, AsyncSnapshot snapshot) {
|
||||
final isErrored = snapshot.hasError &&
|
||||
snapshot.connectionState != ConnectionState.waiting;
|
||||
if (isErrored) {
|
||||
Utils.showSnakeBar(context, "当前操作出错: ${snapshot.error}");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user