修改bug

This commit is contained in:
jyuesong
2022-01-20 14:22:01 +08:00
parent a97aa1f347
commit d4e8dec698
4 changed files with 19 additions and 4 deletions

View File

@@ -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/api.dart';
import 'package:qinglong_app/base/http/http.dart'; import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/module/env/env_bean.dart'; import 'package:qinglong_app/module/env/env_bean.dart';
import 'package:qinglong_app/utils/extension.dart';
var envProvider = ChangeNotifierProvider((ref) => EnvViewModel()); var envProvider = ChangeNotifierProvider((ref) => EnvViewModel());
@@ -29,6 +30,7 @@ class EnvViewModel extends BaseViewModel {
Future<void> delEnv(String id) async { Future<void> delEnv(String id) async {
HttpResponse<NullResponse> result = await Api.delEnv(id); HttpResponse<NullResponse> result = await Api.delEnv(id);
if (result.success) { if (result.success) {
"删除成功".toast();
list.removeWhere((element) => element.sId == id); list.removeWhere((element) => element.sId == id);
notifyListeners(); notifyListeners();
} else { } else {
@@ -53,6 +55,7 @@ class EnvViewModel extends BaseViewModel {
HttpResponse<NullResponse> response = await Api.enableEnv(sId); HttpResponse<NullResponse> response = await Api.enableEnv(sId);
if (response.success) { if (response.success) {
"启用成功".toast();
list.firstWhere((element) => element.sId == sId).status = 0; list.firstWhere((element) => element.sId == sId).status = 0;
success(); success();
} else { } else {
@@ -62,6 +65,7 @@ class EnvViewModel extends BaseViewModel {
HttpResponse<NullResponse> response = await Api.disableEnv(sId); HttpResponse<NullResponse> response = await Api.disableEnv(sId);
if (response.success) { if (response.success) {
"禁用成功".toast();
list.firstWhere((element) => element.sId == sId).status = 1; list.firstWhere((element) => element.sId == sId).status = 1;
success(); success();
} else { } else {

View File

@@ -314,7 +314,8 @@ class _LoginPageState extends ConsumerState<LoginPage> {
const SizedBox( const SizedBox(
height: 30, height: 30,
), ),
Padding( Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 40,), padding: const EdgeInsets.symmetric(horizontal: 40,),
child: SizedBox( child: SizedBox(
width: MediaQuery.of(context).size.width - 80, width: MediaQuery.of(context).size.width - 80,
@@ -324,7 +325,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 5, 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 child: isLoading
? const CupertinoActivityIndicator() ? const CupertinoActivityIndicator()
: const Text( : const Text(

View File

@@ -152,9 +152,12 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
[ [
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () async{
Navigator.of(context).pop(); Navigator.of(context).pop();
startCron(context, ref); await startCron(context, ref);
setState(() {
});
}, },
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -177,6 +180,7 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
showLog(); showLog();
}, },
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

View File

@@ -92,6 +92,8 @@ class TaskViewModel extends BaseViewModel {
HttpResponse<NullResponse> response = await Api.unpinTask(sId); HttpResponse<NullResponse> response = await Api.unpinTask(sId);
if (response.success) { if (response.success) {
"取消置顶成功".toast();
list.firstWhere((element) => element.sId == sId).isPinned = 0;
sortList(); sortList();
success(); success();
} else { } else {
@@ -101,6 +103,8 @@ class TaskViewModel extends BaseViewModel {
HttpResponse<NullResponse> response = await Api.pinTask(sId); HttpResponse<NullResponse> response = await Api.pinTask(sId);
if (response.success) { if (response.success) {
"置顶成功".toast();
list.firstWhere((element) => element.sId == sId).isPinned = 1;
sortList(); sortList();
success(); success();
} else { } else {
@@ -114,6 +118,7 @@ class TaskViewModel extends BaseViewModel {
HttpResponse<NullResponse> response = await Api.disableTask(sId); HttpResponse<NullResponse> response = await Api.disableTask(sId);
if (response.success) { if (response.success) {
"禁用成功".toast();
list.firstWhere((element) => element.sId == sId).isDisabled = 1; list.firstWhere((element) => element.sId == sId).isDisabled = 1;
sortList(); sortList();
success(); success();
@@ -124,6 +129,7 @@ class TaskViewModel extends BaseViewModel {
HttpResponse<NullResponse> response = await Api.enableTask(sId); HttpResponse<NullResponse> response = await Api.enableTask(sId);
if (response.success) { if (response.success) {
"启用成功".toast();
list.firstWhere((element) => element.sId == sId).isDisabled = 0; list.firstWhere((element) => element.sId == sId).isDisabled = 0;
sortList(); sortList();
success(); success();