mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
feat: display loading animation
This commit is contained in:
@@ -32,7 +32,9 @@ class Utils {
|
||||
);
|
||||
}
|
||||
|
||||
static showSnakeBar(String msg) {
|
||||
}
|
||||
|
||||
showSnakeBar(String msg) {
|
||||
final context = APIs.navigatorKey.currentContext;
|
||||
if (context != null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
@@ -42,17 +44,6 @@ class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static bool showError(BuildContext context, AsyncSnapshot snapshot) {
|
||||
final isErrored = snapshot.hasError &&
|
||||
snapshot.connectionState != ConnectionState.waiting;
|
||||
if (isErrored) {
|
||||
Utils.showSnakeBar("当前操作出错: ${snapshot.error}");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extension FileFormatter on num {
|
||||
String readableFileSize({bool base1024 = true}) {
|
||||
final base = base1024 ? 1024 : 1000;
|
||||
|
||||
Reference in New Issue
Block a user