mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
format code
This commit is contained in:
15
lib/module/env/env_viewmodel.dart
vendored
15
lib/module/env/env_viewmodel.dart
vendored
@@ -19,7 +19,6 @@ class EnvViewModel extends BaseViewModel {
|
||||
if (result.success && result.bean != null) {
|
||||
list.clear();
|
||||
list.addAll(result.bean!);
|
||||
sortList();
|
||||
success();
|
||||
} else {
|
||||
list.clear();
|
||||
@@ -27,12 +26,6 @@ class EnvViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
void sortList() {
|
||||
list.sort((a, b) {
|
||||
return a.status!.compareTo(b.status!);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> delEnv(String id) async {
|
||||
HttpResponse<NullResponse> result = await Api.delEnv(id);
|
||||
if (result.success) {
|
||||
@@ -61,7 +54,6 @@ class EnvViewModel extends BaseViewModel {
|
||||
|
||||
if (response.success) {
|
||||
list.firstWhere((element) => element.sId == sId).status = 0;
|
||||
sortList();
|
||||
success();
|
||||
} else {
|
||||
failToast(response.message, notify: true);
|
||||
@@ -71,14 +63,15 @@ class EnvViewModel extends BaseViewModel {
|
||||
|
||||
if (response.success) {
|
||||
list.firstWhere((element) => element.sId == sId).status = 1;
|
||||
sortList();
|
||||
success();
|
||||
} else {
|
||||
failToast(response.message, notify: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
void update(){
|
||||
// update
|
||||
|
||||
void update(String id, int newIndex, int oldIndex) async {
|
||||
await Api.moveEnv(id, oldIndex, newIndex);
|
||||
loadData(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user