mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
优化使用体验
This commit is contained in:
@@ -8,7 +8,7 @@ class TokenInterceptor extends Interceptor {
|
|||||||
@override
|
@override
|
||||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||||
options.headers["User-Agent"] =
|
options.headers["User-Agent"] =
|
||||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
"qinglong_client";
|
||||||
|
|
||||||
options.headers["Content-Type"] = "application/json;charset=UTF-8";
|
options.headers["Content-Type"] = "application/json;charset=UTF-8";
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class UserInfoViewModel {
|
|||||||
|
|
||||||
historyAccounts.insert(0, UserInfoBean(userName: _userName, password: _passWord, useSecretLogined: _useSecertLogined, host: _host));
|
historyAccounts.insert(0, UserInfoBean(userName: _userName, password: _passWord, useSecretLogined: _useSecertLogined, host: _host));
|
||||||
|
|
||||||
while (historyAccounts.length > 5) {
|
while (historyAccounts.length > 3) {
|
||||||
historyAccounts.removeLast();
|
historyAccounts.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -180,6 +181,7 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,6 @@ import 'package:qinglong_app/module/task/task_bean.dart';
|
|||||||
import 'package:qinglong_app/utils/extension.dart';
|
import 'package:qinglong_app/utils/extension.dart';
|
||||||
|
|
||||||
var taskProvider = ChangeNotifierProvider((ref) => TaskViewModel());
|
var taskProvider = ChangeNotifierProvider((ref) => TaskViewModel());
|
||||||
Map<int, int> sort = {
|
|
||||||
0: 0,
|
|
||||||
5: 1,
|
|
||||||
3: 2,
|
|
||||||
1: 3,
|
|
||||||
4: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
class TaskViewModel extends BaseViewModel {
|
class TaskViewModel extends BaseViewModel {
|
||||||
static const String allStr = "全部脚本";
|
static const String allStr = "全部脚本";
|
||||||
@@ -45,27 +38,81 @@ class TaskViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sortList() {
|
void sortList() {
|
||||||
list.sort((TaskBean a, TaskBean b) {
|
List<TaskBean> p = [];
|
||||||
int? sortA = (a.isPinned == 1 && a.status != 0)
|
List<TaskBean> r = [];
|
||||||
? 5
|
List<TaskBean> d = [];
|
||||||
: (a.isDisabled == 1 && a.status != 0)
|
|
||||||
? 4
|
|
||||||
: a.status;
|
|
||||||
int? sortB = (b.isPinned == 1 && b.status != 0)
|
|
||||||
? 5
|
|
||||||
: (b.isDisabled == 1 && b.status != 0)
|
|
||||||
? 4
|
|
||||||
: b.status;
|
|
||||||
|
|
||||||
return sort[sortA!]! - sort[sortB!]!;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
if (list[i].isPinned == 1) {
|
if (list[i].isPinned == 1) {
|
||||||
list.insert(0, list.removeAt(i));
|
p.add(list.removeAt(i));
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list[i].status == 0) {
|
||||||
|
r.add(list.removeAt(i));
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (list[i].isDisabled == 1) {
|
||||||
|
d.add(list.removeAt(i));
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.sort((TaskBean a, TaskBean b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
p.sort((a, b) {
|
||||||
|
return (a.isDisabled ?? 0) - (b.isDisabled ?? 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
p.sort((a, b) {
|
||||||
|
if (a.status == 0 && b.status == 0) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return (a.status ?? 0) - (b.status ?? 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
r.sort((a, b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
d.sort((a, b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
list.sort((a, b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
list.insertAll(0, r);
|
||||||
|
list.insertAll(0, p);
|
||||||
|
list.addAll(d);
|
||||||
|
|
||||||
running.clear();
|
running.clear();
|
||||||
running.addAll(list.where((element) => element.status == 0));
|
running.addAll(list.where((element) => element.status == 0));
|
||||||
neverRunning.clear();
|
neverRunning.clear();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: qinglong_app
|
name: qinglong_app
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
version: 1.0.8+10
|
version: 1.0.9+11
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.15.1 <3.0.0"
|
sdk: ">=2.15.1 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user