mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
30 lines
810 B
Dart
30 lines
810 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
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_detail/task_detail_bean.dart';
|
|
|
|
var taskDetailProvider =
|
|
AutoDisposeChangeNotifierProvider<TaskDetailViewModel>((ref) {
|
|
return TaskDetailViewModel();
|
|
});
|
|
|
|
class TaskDetailViewModel extends BaseViewModel {
|
|
TaskDetailBean? bean;
|
|
|
|
TaskDetailViewModel();
|
|
|
|
Future<void> loadDetail(String id) async {
|
|
loading(notify: true);
|
|
|
|
HttpResponse<TaskDetailBean> response = await Api.taskDetail(id);
|
|
|
|
if (response.success) {
|
|
bean = response.bean;
|
|
success();
|
|
} else {
|
|
failed(response.message, notify: true);
|
|
}
|
|
}
|
|
}
|