mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
add setting
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:qinglong_app/base/sp_const.dart';
|
||||
import 'package:qinglong_app/utils/codeeditor_theme.dart';
|
||||
@@ -14,8 +15,9 @@ class ThemeViewModel extends ChangeNotifier {
|
||||
ThemeColors themeColor = LightThemeColors();
|
||||
|
||||
ThemeViewModel() {
|
||||
bool dartMode = SpUtil.getBool(sp_Theme, defValue: false);
|
||||
changeThemeReal(dartMode, false);
|
||||
var brightness = SchedulerBinding.instance!.window.platformBrightness;
|
||||
bool isDarkMode = brightness == Brightness.dark;
|
||||
changeThemeReal(isDarkMode, false);
|
||||
}
|
||||
|
||||
bool isInDartMode() {
|
||||
|
||||
12
lib/module/env/add_env_page.dart
vendored
12
lib/module/env/add_env_page.dart
vendored
@@ -58,7 +58,13 @@ class _AddEnvPageState extends ConsumerState<AddEnvPage> {
|
||||
horizontal: 15,
|
||||
),
|
||||
child: Center(
|
||||
child: Text("提交"),
|
||||
child: Text(
|
||||
"提交",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -185,7 +191,9 @@ class _AddEnvPageState extends ConsumerState<AddEnvPage> {
|
||||
envBean.name = _nameController.text;
|
||||
envBean.value = _valueController.text;
|
||||
envBean.remarks = _remarkController.text;
|
||||
HttpResponse<NullResponse> response = await Api.addEnv(_nameController.text, _valueController.text, _remarkController.text, id: envBean.sId);
|
||||
HttpResponse<NullResponse> response = await Api.addEnv(
|
||||
_nameController.text, _valueController.text, _remarkController.text,
|
||||
id: envBean.sId);
|
||||
|
||||
if (response.success) {
|
||||
successDialog(context, "操作成功").then((value) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
child: Icon(
|
||||
CupertinoIcons.add,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -68,6 +69,7 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
child: Icon(
|
||||
CupertinoIcons.add,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -82,7 +84,13 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
horizontal: 15,
|
||||
),
|
||||
child: Center(
|
||||
child: Text("编辑"),
|
||||
child: Text(
|
||||
"编辑",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
@@ -56,7 +56,13 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
||||
horizontal: 15,
|
||||
),
|
||||
child: Center(
|
||||
child: Text("提交"),
|
||||
child: Text(
|
||||
"提交",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -189,7 +195,9 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
||||
taskBean.name = _nameController.text;
|
||||
taskBean.command = _commandController.text;
|
||||
taskBean.schedule = _cronController.text;
|
||||
HttpResponse<TaskDetailBean> response = await Api.addTask(_nameController.text, _commandController.text, _cronController.text, id: taskBean.sId);
|
||||
HttpResponse<TaskDetailBean> response = await Api.addTask(
|
||||
_nameController.text, _commandController.text, _cronController.text,
|
||||
id: taskBean.sId);
|
||||
|
||||
if (response.success) {
|
||||
successDialog(context, "操作成功").then((value) {
|
||||
@@ -197,7 +205,7 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
} else {
|
||||
failDialog(context, response.message ??"");
|
||||
failDialog(context, response.message ?? "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,29 +397,31 @@ class TaskItemCell extends StatelessWidget {
|
||||
}
|
||||
|
||||
logCron(BuildContext context, WidgetRef ref) {
|
||||
showCupertinoDialog(
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(
|
||||
"${bean.name}运行日志",
|
||||
maxLines: 1,
|
||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
content: InTimeLogPage(bean.sId!, bean.status == 0),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"知道了",
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||
showCupertinoDialog(
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(
|
||||
"${bean.name}运行日志",
|
||||
maxLines: 1,
|
||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
context: context);
|
||||
content: InTimeLogPage(bean.sId!, bean.status == 0),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"知道了",
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
context: context);
|
||||
});
|
||||
}
|
||||
|
||||
more(BuildContext context, WidgetRef ref) {
|
||||
|
||||
Reference in New Issue
Block a user