From 917425c5de1b1be2d80fa9ae21d7b628fc2c7a33 Mon Sep 17 00:00:00 2001 From: NewTab <425698907@qq.com> Date: Mon, 17 Jan 2022 20:52:22 +0800 Subject: [PATCH] add setting --- .../res/drawable-night-v21/background.png | Bin 70 -> 70 bytes .../main/res/drawable-night/background.png | Bin 70 -> 70 bytes ios/Runner.xcodeproj/project.pbxproj | 3 + .../darkbackground.png | Bin 70 -> 70 bytes ios/Runner/Info.plist | 92 +++++++++--------- lib/base/theme.dart | 6 +- lib/module/env/add_env_page.dart | 12 ++- lib/module/home/home_page.dart | 10 +- lib/module/task/add_task_page.dart | 14 ++- lib/module/task/task_page.dart | 46 ++++----- pubspec.yaml | 2 +- web/splash/style.css | 2 +- 12 files changed, 109 insertions(+), 78 deletions(-) diff --git a/android/app/src/main/res/drawable-night-v21/background.png b/android/app/src/main/res/drawable-night-v21/background.png index 39ea62cba47f5c185350070185306be1f3a8154e..1b5df34e7b11f0f86b98ee1597aa936078ce13fb 100644 GIT binary patch delta 31 lcmZ>Bo1i0=n2_*;pMg<=ktKj_YZn6$c)I$ztaD0e0sw&i2rvKu delta 31 kcmZ>Bo1i0g(fG=5eg>xfj1zavVPXIQPgg&ebxsLQ0H<;Z-~a#s diff --git a/android/app/src/main/res/drawable-night/background.png b/android/app/src/main/res/drawable-night/background.png index 39ea62cba47f5c185350070185306be1f3a8154e..1b5df34e7b11f0f86b98ee1597aa936078ce13fb 100644 GIT binary patch delta 31 lcmZ>Bo1i0=n2_*;pMg<=ktKj_YZn6$c)I$ztaD0e0sw&i2rvKu delta 31 kcmZ>Bo1i0g(fG=5eg>xfj1zavVPXIQPgg&ebxsLQ0H<;Z-~a#s diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 98d845e..8300e26 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -341,6 +341,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = ""; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -421,6 +422,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = ""; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -469,6 +471,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = ""; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/ios/Runner/Assets.xcassets/LaunchBackground.imageset/darkbackground.png b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/darkbackground.png index 39ea62cba47f5c185350070185306be1f3a8154e..1b5df34e7b11f0f86b98ee1597aa936078ce13fb 100644 GIT binary patch delta 31 lcmZ>Bo1i0=n2_*;pMg<=ktKj_YZn6$c)I$ztaD0e0sw&i2rvKu delta 31 kcmZ>Bo1i0g(fG=5eg>xfj1zavVPXIQPgg&ebxsLQ0H<;Z-~a#s diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 800a4a2..390aa6e 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -1,49 +1,49 @@ - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Qinglong App - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - 青龙 - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - UIStatusBarHidden - - - \ No newline at end of file + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + 青龙 + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + 青龙 + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + UIStatusBarHidden + + + diff --git a/lib/base/theme.dart b/lib/base/theme.dart index 3c233d0..019cbef 100644 --- a/lib/base/theme.dart +++ b/lib/base/theme.dart @@ -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() { diff --git a/lib/module/env/add_env_page.dart b/lib/module/env/add_env_page.dart index 8e5dcff..2f04575 100644 --- a/lib/module/env/add_env_page.dart +++ b/lib/module/env/add_env_page.dart @@ -58,7 +58,13 @@ class _AddEnvPageState extends ConsumerState { horizontal: 15, ), child: Center( - child: Text("提交"), + child: Text( + "提交", + style: TextStyle( + color: Colors.white, + fontSize: 16, + ), + ), ), ), ) @@ -185,7 +191,9 @@ class _AddEnvPageState extends ConsumerState { envBean.name = _nameController.text; envBean.value = _valueController.text; envBean.remarks = _remarkController.text; - HttpResponse response = await Api.addEnv(_nameController.text, _valueController.text, _remarkController.text, id: envBean.sId); + HttpResponse response = await Api.addEnv( + _nameController.text, _valueController.text, _remarkController.text, + id: envBean.sId); if (response.success) { successDialog(context, "操作成功").then((value) { diff --git a/lib/module/home/home_page.dart b/lib/module/home/home_page.dart index 606d6c4..1d63211 100644 --- a/lib/module/home/home_page.dart +++ b/lib/module/home/home_page.dart @@ -49,6 +49,7 @@ class _HomePageState extends ConsumerState { child: Icon( CupertinoIcons.add, size: 20, + color: Colors.white, ), ), ), @@ -68,6 +69,7 @@ class _HomePageState extends ConsumerState { child: Icon( CupertinoIcons.add, size: 20, + color: Colors.white, ), ), ), @@ -82,7 +84,13 @@ class _HomePageState extends ConsumerState { horizontal: 15, ), child: Center( - child: Text("编辑"), + child: Text( + "编辑", + style: TextStyle( + color: Colors.white, + fontSize: 16, + ), + ), ), ), )); diff --git a/lib/module/task/add_task_page.dart b/lib/module/task/add_task_page.dart index 32489df..6b5df2f 100644 --- a/lib/module/task/add_task_page.dart +++ b/lib/module/task/add_task_page.dart @@ -56,7 +56,13 @@ class _AddTaskPageState extends ConsumerState { horizontal: 15, ), child: Center( - child: Text("提交"), + child: Text( + "提交", + style: TextStyle( + color: Colors.white, + fontSize: 16, + ), + ), ), ), ) @@ -189,7 +195,9 @@ class _AddTaskPageState extends ConsumerState { taskBean.name = _nameController.text; taskBean.command = _commandController.text; taskBean.schedule = _cronController.text; - HttpResponse response = await Api.addTask(_nameController.text, _commandController.text, _cronController.text, id: taskBean.sId); + HttpResponse 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 { Navigator.of(context).pop(); }); } else { - failDialog(context, response.message ??""); + failDialog(context, response.message ?? ""); } } } diff --git a/lib/module/task/task_page.dart b/lib/module/task/task_page.dart index 6eea781..958e29a 100644 --- a/lib/module/task/task_page.dart +++ b/lib/module/task/task_page.dart @@ -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) { diff --git a/pubspec.yaml b/pubspec.yaml index d235d2a..4aa110e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -98,7 +98,7 @@ flutter_native_splash: # parameters from above. If the image_dark parameter is specified, color_dark or # background_image_dark must be specified. color_dark and background_image_dark cannot both be # set. - color_dark: "#2E312E" + color_dark: "#000000" # background_image_dark: "assets/dark-background.png" # image_dark: assets/splash-invert.png diff --git a/web/splash/style.css b/web/splash/style.css index bbafb62..20a0cac 100644 --- a/web/splash/style.css +++ b/web/splash/style.css @@ -36,7 +36,7 @@ body, html { body { margin:0; height:100%; - background: #2E312E; + background: #000000; background-size: 100% 100%; }