mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
add
This commit is contained in:
@@ -6,14 +6,13 @@ import 'package:qinglong_app/base/base_viewmodel.dart';
|
||||
import 'package:qinglong_app/base/http/api.dart';
|
||||
import 'package:qinglong_app/base/http/http.dart';
|
||||
import 'package:qinglong_app/module/task/task_bean.dart';
|
||||
import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
|
||||
|
||||
var taskProvider = ChangeNotifierProvider((ref) => TaskViewModel());
|
||||
|
||||
class TaskViewModel extends BaseViewModel {
|
||||
List<TaskBean> list = [];
|
||||
|
||||
String temp = "sadad";
|
||||
|
||||
Future<void> loadData([isLoading = true]) async {
|
||||
if (isLoading) {
|
||||
loading(notify: true);
|
||||
@@ -74,4 +73,16 @@ class TaskViewModel extends BaseViewModel {
|
||||
failed(result.message, notify: true);
|
||||
}
|
||||
}
|
||||
|
||||
void updateBean(TaskBean result) {
|
||||
if (result.sId == null) {
|
||||
loadData(false);
|
||||
return;
|
||||
}
|
||||
TaskBean bean = list.firstWhere((element) => element.sId == result.sId);
|
||||
bean.name = result.name;
|
||||
bean.schedule = result.schedule;
|
||||
bean.command = result.command;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user