This commit is contained in:
jyuesong
2022-01-21 16:34:05 +08:00
parent b390876bd5
commit 744e421eb7
4 changed files with 44 additions and 30 deletions

View File

@@ -87,7 +87,7 @@ class Api {
static Future<HttpResponse<NullResponse>> stopTasks(List<String> crons) async { static Future<HttpResponse<NullResponse>> stopTasks(List<String> crons) async {
return await Http.put<NullResponse>( return await Http.put<NullResponse>(
Url.runTasks, Url.stopTasks,
crons, crons,
); );
} }

View File

@@ -149,6 +149,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
), ),
FlipCard( FlipCard(
key: cardKey, key: cardKey,
flipOnTouch: false,
onFlipDone: (back) { onFlipDone: (back) {
useSecretLogin = back; useSecretLogin = back;
setState(() {}); setState(() {});
@@ -298,13 +299,13 @@ class _LoginPageState extends ConsumerState<LoginPage> {
}); });
}, },
child: Text( child: Text(
loginByUserName() ? "client_id登录" : "用户名密码登录", loginByUserName() ? "client_id登录" : "账号登录",
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
SizedBox( const SizedBox(
width: 10, width: 10,
), ),
], ],

View File

@@ -178,7 +178,11 @@ class TaskItemCell extends StatelessWidget {
trailingIcon: bean.status! == 1 ? CupertinoIcons.memories : CupertinoIcons.stop_circle, trailingIcon: bean.status! == 1 ? CupertinoIcons.memories : CupertinoIcons.stop_circle,
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
startCron(context, ref); if (bean.status! == 1) {
startCron(context, ref);
} else {
stopCron(context, ref);
}
}, },
), ),
QLCupertinoContextMenuAction( QLCupertinoContextMenuAction(
@@ -236,8 +240,8 @@ class TaskItemCell extends StatelessWidget {
top: 5, top: 5,
bottom: isDark ? 5 : 20, bottom: isDark ? 5 : 20,
), ),
child: ClipRRect( child: SizedBox(
borderRadius: BorderRadius.circular(15), height: 200,
child: TaskDetailPage( child: TaskDetailPage(
bean, bean,
hideAppbar: true, hideAppbar: true,
@@ -266,33 +270,40 @@ class TaskItemCell extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Material( child: Row(
color: Colors.transparent, mainAxisSize: MainAxisSize.max,
child: Text( mainAxisAlignment: MainAxisAlignment.start,
bean.name ?? "", children: [
maxLines: 1, bean.status == 1
overflow: TextOverflow.ellipsis, ? const SizedBox.shrink()
style: TextStyle( : const SizedBox(
overflow: TextOverflow.ellipsis, width: 15,
color: ref.watch(themeProvider).themeColor.titleColor(), height: 15,
fontSize: 18, child: CircularProgressIndicator(
strokeWidth: 2,
),
),
const SizedBox(
width: 5,
), ),
), Expanded(
), child: Material(
), color: Colors.transparent,
const SizedBox( child: Text(
width: 5, bean.name ?? "",
), maxLines: 1,
bean.status == 1 overflow: TextOverflow.ellipsis,
? const SizedBox.shrink() style: TextStyle(
: const SizedBox( overflow: TextOverflow.ellipsis,
width: 15, color: ref.watch(themeProvider).themeColor.titleColor(),
height: 15, fontSize: 18,
child: CircularProgressIndicator( ),
strokeWidth: 2, ),
), ),
), ),
const Spacer(), ],
),
),
Material( Material(
color: Colors.transparent, color: Colors.transparent,
child: Text( child: Text(

View File

@@ -48,6 +48,7 @@ class TaskViewModel extends BaseViewModel {
HttpResponse<NullResponse> result = await Api.startTasks([cron]); HttpResponse<NullResponse> result = await Api.startTasks([cron]);
if (result.success) { if (result.success) {
list.firstWhere((element) => element.sId == cron).status = 0; list.firstWhere((element) => element.sId == cron).status = 0;
sortList();
notifyListeners(); notifyListeners();
} else { } else {
failToast(result.message, notify: true); failToast(result.message, notify: true);
@@ -58,6 +59,7 @@ class TaskViewModel extends BaseViewModel {
HttpResponse<NullResponse> result = await Api.stopTasks([cron]); HttpResponse<NullResponse> result = await Api.stopTasks([cron]);
if (result.success) { if (result.success) {
list.firstWhere((element) => element.sId == cron).status = 1; list.firstWhere((element) => element.sId == cron).status = 1;
sortList();
notifyListeners(); notifyListeners();
} else { } else {
failToast(result.message, notify: true); failToast(result.message, notify: true);