mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
修改bug
This commit is contained in:
4
lib/module/env/env_viewmodel.dart
vendored
4
lib/module/env/env_viewmodel.dart
vendored
@@ -3,6 +3,7 @@ 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/env/env_bean.dart';
|
||||
import 'package:qinglong_app/utils/extension.dart';
|
||||
|
||||
var envProvider = ChangeNotifierProvider((ref) => EnvViewModel());
|
||||
|
||||
@@ -29,6 +30,7 @@ class EnvViewModel extends BaseViewModel {
|
||||
Future<void> delEnv(String id) async {
|
||||
HttpResponse<NullResponse> result = await Api.delEnv(id);
|
||||
if (result.success) {
|
||||
"删除成功".toast();
|
||||
list.removeWhere((element) => element.sId == id);
|
||||
notifyListeners();
|
||||
} else {
|
||||
@@ -53,6 +55,7 @@ class EnvViewModel extends BaseViewModel {
|
||||
HttpResponse<NullResponse> response = await Api.enableEnv(sId);
|
||||
|
||||
if (response.success) {
|
||||
"启用成功".toast();
|
||||
list.firstWhere((element) => element.sId == sId).status = 0;
|
||||
success();
|
||||
} else {
|
||||
@@ -62,6 +65,7 @@ class EnvViewModel extends BaseViewModel {
|
||||
HttpResponse<NullResponse> response = await Api.disableEnv(sId);
|
||||
|
||||
if (response.success) {
|
||||
"禁用成功".toast();
|
||||
list.firstWhere((element) => element.sId == sId).status = 1;
|
||||
success();
|
||||
} else {
|
||||
|
||||
@@ -314,7 +314,8 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Padding(
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40,),
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width - 80,
|
||||
@@ -324,7 +325,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
),
|
||||
color: canClickLoginBtn() ? ref.watch(themeProvider).themeColor.buttonBgColor() : Theme.of(context).primaryColor.withOpacity(0.4),
|
||||
color: canClickLoginBtn() ? primaryColor : primaryColor.withOpacity(0.4),
|
||||
child: isLoading
|
||||
? const CupertinoActivityIndicator()
|
||||
: const Text(
|
||||
|
||||
@@ -152,9 +152,12 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
|
||||
[
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
onTap: () async{
|
||||
Navigator.of(context).pop();
|
||||
startCron(context, ref);
|
||||
await startCron(context, ref);
|
||||
setState(() {
|
||||
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -177,6 +180,7 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
showLog();
|
||||
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
||||
@@ -92,6 +92,8 @@ class TaskViewModel extends BaseViewModel {
|
||||
HttpResponse<NullResponse> response = await Api.unpinTask(sId);
|
||||
|
||||
if (response.success) {
|
||||
"取消置顶成功".toast();
|
||||
list.firstWhere((element) => element.sId == sId).isPinned = 0;
|
||||
sortList();
|
||||
success();
|
||||
} else {
|
||||
@@ -101,6 +103,8 @@ class TaskViewModel extends BaseViewModel {
|
||||
HttpResponse<NullResponse> response = await Api.pinTask(sId);
|
||||
|
||||
if (response.success) {
|
||||
"置顶成功".toast();
|
||||
list.firstWhere((element) => element.sId == sId).isPinned = 1;
|
||||
sortList();
|
||||
success();
|
||||
} else {
|
||||
@@ -114,6 +118,7 @@ class TaskViewModel extends BaseViewModel {
|
||||
HttpResponse<NullResponse> response = await Api.disableTask(sId);
|
||||
|
||||
if (response.success) {
|
||||
"禁用成功".toast();
|
||||
list.firstWhere((element) => element.sId == sId).isDisabled = 1;
|
||||
sortList();
|
||||
success();
|
||||
@@ -124,6 +129,7 @@ class TaskViewModel extends BaseViewModel {
|
||||
HttpResponse<NullResponse> response = await Api.enableTask(sId);
|
||||
|
||||
if (response.success) {
|
||||
"启用成功".toast();
|
||||
list.firstWhere((element) => element.sId == sId).isDisabled = 0;
|
||||
sortList();
|
||||
success();
|
||||
|
||||
Reference in New Issue
Block a user