From ca6f1db16f50f622e22a759a9173e4584b4e3e91 Mon Sep 17 00:00:00 2001 From: jyuesong <425698907@qq.com> Date: Wed, 19 Jan 2022 09:15:31 +0800 Subject: [PATCH] update style --- lib/base/http/http.dart | 1 - lib/base/theme.dart | 6 +- lib/main.dart | 3 - lib/module/env/env_page.dart | 55 +++++++++---------- .../others/dependencies/dependency_page.dart | 4 +- .../others/login_log/login_log_page.dart | 2 +- lib/module/others/other_page.dart | 10 ++-- lib/module/others/scripts/script_page.dart | 6 +- lib/module/others/task_log/task_log_page.dart | 6 +- lib/module/task/task_page.dart | 4 +- lib/utils/QlNavigatorObserver.dart | 16 ------ 11 files changed, 46 insertions(+), 67 deletions(-) delete mode 100644 lib/utils/QlNavigatorObserver.dart diff --git a/lib/base/http/http.dart b/lib/base/http/http.dart index 180ca2b..2f27109 100644 --- a/lib/base/http/http.dart +++ b/lib/base/http/http.dart @@ -6,7 +6,6 @@ import 'package:dio_log/dio_log.dart'; import 'package:flutter/foundation.dart'; import 'package:qinglong_app/base/http/token_interceptor.dart'; import 'package:qinglong_app/base/userinfo_viewmodel.dart'; -import 'package:qinglong_app/utils/QlNavigatorObserver.dart'; import '../../json.jc.dart'; import '../../main.dart'; diff --git a/lib/base/theme.dart b/lib/base/theme.dart index e314601..279cf47 100644 --- a/lib/base/theme.dart +++ b/lib/base/theme.dart @@ -157,7 +157,7 @@ ThemeData lightTheme = ThemeData.light().copyWith( abstract class ThemeColors { Color settingBgColor(); - Color taskTitleColor(); + Color titleColor(); Color descColor(); @@ -170,7 +170,7 @@ abstract class ThemeColors { class LightThemeColors extends ThemeColors { @override - Color taskTitleColor() { + Color titleColor() { return const Color(0xff333333); } @@ -202,7 +202,7 @@ class LightThemeColors extends ThemeColors { class DartThemeColors extends ThemeColors { @override - Color taskTitleColor() { + Color titleColor() { return Colors.white; } diff --git a/lib/main.dart b/lib/main.dart index 4f0f32a..59cabc1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,6 @@ import 'package:get_it/get_it.dart'; import 'package:logger/logger.dart'; import 'package:qinglong_app/base/theme.dart'; import 'package:qinglong_app/module/login/login_page.dart'; -import 'package:qinglong_app/utils/QlNavigatorObserver.dart'; import 'package:qinglong_app/utils/sp_utils.dart'; import 'base/routes.dart'; @@ -25,7 +24,6 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); await SpUtil.getInstance(); getIt.registerSingleton(UserInfoViewModel()); - getIt.registerSingleton(QlNavigatorObserver()); runApp( ProviderScope( @@ -58,7 +56,6 @@ class QlAppState extends ConsumerState { }, child: MaterialApp( locale: const Locale('zh', 'cn'), - navigatorObservers: [getIt()], navigatorKey: navigatorState, theme: ref.watch(themeProvider).currentTheme, onGenerateRoute: (setting) { diff --git a/lib/module/env/env_page.dart b/lib/module/env/env_page.dart index bac4f48..3403c8f 100644 --- a/lib/module/env/env_page.dart +++ b/lib/module/env/env_page.dart @@ -49,8 +49,7 @@ class _EnvPageState extends State { return model.loadData(false); }, child: ReorderableListView( - keyboardDismissBehavior: - ScrollViewKeyboardDismissBehavior.onDrag, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag, header: searchCell(ref), onReorder: (int oldIndex, int newIndex) { if (list.length != model.list.length) { @@ -142,8 +141,7 @@ class EnvItemCell extends StatelessWidget { backgroundColor: Colors.grey, flex: 1, onPressed: (_) { - Navigator.of(context) - .pushNamed(Routes.routeAddEnv, arguments: bean); + Navigator.of(context).pushNamed(Routes.routeAddEnv, arguments: bean); }, foregroundColor: Colors.white, icon: CupertinoIcons.pencil, @@ -155,9 +153,7 @@ class EnvItemCell extends StatelessWidget { enableEnv(); }, foregroundColor: Colors.white, - icon: bean.status == 0 - ? Icons.dnd_forwardslash - : Icons.check_circle_outline_sharp, + icon: bean.status == 0 ? Icons.dnd_forwardslash : Icons.check_circle_outline_sharp, ), SlidableAction( backgroundColor: Colors.red, @@ -190,22 +186,29 @@ class EnvItemCell extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( - child: Material( - color: Colors.transparent, - child: Text( - bean.name ?? "", - maxLines: 1, - style: TextStyle( - overflow: TextOverflow.ellipsis, - color: bean.status == 1 - ? const Color(0xffF85152) - : ref - .watch(themeProvider) - .themeColor - .taskTitleColor(), - fontSize: 18, + child: Row( + children: [ + Material( + color: Colors.transparent, + child: Text( + bean.name ?? "", + maxLines: 1, + style: TextStyle( + overflow: TextOverflow.ellipsis, + color: ref.watch(themeProvider).themeColor.titleColor(), + fontSize: 18, + ), + ), ), - ), + bean.status == 1 + ? const Icon( + Icons.dnd_forwardslash, + size: 12, + color: Colors.red, + ) + : const SizedBox.shrink(), + const Spacer(), + ], ), ), const SizedBox( @@ -218,10 +221,7 @@ class EnvItemCell extends StatelessWidget { maxLines: 1, style: TextStyle( overflow: TextOverflow.ellipsis, - color: ref - .watch(themeProvider) - .themeColor - .descColor(), + color: ref.watch(themeProvider).themeColor.descColor(), fontSize: 12, ), ), @@ -238,8 +238,7 @@ class EnvItemCell extends StatelessWidget { maxLines: 1, style: TextStyle( overflow: TextOverflow.ellipsis, - color: - ref.watch(themeProvider).themeColor.descColor(), + color: ref.watch(themeProvider).themeColor.descColor(), fontSize: 12, ), ), diff --git a/lib/module/others/dependencies/dependency_page.dart b/lib/module/others/dependencies/dependency_page.dart index 5a44e90..6a3cfee 100644 --- a/lib/module/others/dependencies/dependency_page.dart +++ b/lib/module/others/dependencies/dependency_page.dart @@ -187,7 +187,7 @@ class DependencyCell extends ConsumerWidget { maxLines: 1, style: TextStyle( overflow: TextOverflow.ellipsis, - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 18, ), ), @@ -220,7 +220,7 @@ class DependencyCell extends ConsumerWidget { maxLines: 1, style: TextStyle( overflow: TextOverflow.ellipsis, - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 18, ), ), diff --git a/lib/module/others/login_log/login_log_page.dart b/lib/module/others/login_log/login_log_page.dart index eea594a..61d646d 100644 --- a/lib/module/others/login_log/login_log_page.dart +++ b/lib/module/others/login_log/login_log_page.dart @@ -50,7 +50,7 @@ class _LoginLogPageState extends ConsumerState with LazyLoadState< Utils.formatMessageTime(item.timestamp ?? 0), style: TextStyle( fontSize: 16, - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), ), ), subtitle: Column( diff --git a/lib/module/others/other_page.dart b/lib/module/others/other_page.dart index bdc9a9b..7dc079e 100644 --- a/lib/module/others/other_page.dart +++ b/lib/module/others/other_page.dart @@ -57,7 +57,7 @@ class _OtherPageState extends ConsumerState { Text( "脚本管理", style: TextStyle( - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), @@ -90,7 +90,7 @@ class _OtherPageState extends ConsumerState { Text( "依赖管理", style: TextStyle( - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), @@ -123,7 +123,7 @@ class _OtherPageState extends ConsumerState { Text( "任务日志", style: TextStyle( - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), @@ -157,7 +157,7 @@ class _OtherPageState extends ConsumerState { Text( "登录日志", style: TextStyle( - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), @@ -202,7 +202,7 @@ class _OtherPageState extends ConsumerState { Text( "夜间模式", style: TextStyle( - color: ref.watch(themeProvider).themeColor.taskTitleColor(), + color: ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), diff --git a/lib/module/others/scripts/script_page.dart b/lib/module/others/scripts/script_page.dart index f7c3bbe..2d64ac9 100644 --- a/lib/module/others/scripts/script_page.dart +++ b/lib/module/others/scripts/script_page.dart @@ -53,7 +53,7 @@ class _ScriptPageState extends ConsumerState { style: TextStyle( color: (item.disabled ?? false) ? ref.watch(themeProvider).themeColor.descColor() - : ref.watch(themeProvider).themeColor.taskTitleColor(), + : ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), @@ -73,7 +73,7 @@ class _ScriptPageState extends ConsumerState { style: TextStyle( color: (item.disabled ?? false) ? ref.watch(themeProvider).themeColor.descColor() - : ref.watch(themeProvider).themeColor.taskTitleColor(), + : ref.watch(themeProvider).themeColor.titleColor(), fontSize: 14, ), ), @@ -95,7 +95,7 @@ class _ScriptPageState extends ConsumerState { style: TextStyle( color: (item.disabled ?? false) ? ref.watch(themeProvider).themeColor.descColor() - : ref.watch(themeProvider).themeColor.taskTitleColor(), + : ref.watch(themeProvider).themeColor.titleColor(), fontSize: 16, ), ), diff --git a/lib/module/others/task_log/task_log_page.dart b/lib/module/others/task_log/task_log_page.dart index 7f3cfeb..69e2273 100644 --- a/lib/module/others/task_log/task_log_page.dart +++ b/lib/module/others/task_log/task_log_page.dart @@ -46,7 +46,7 @@ class _TaskLogPageState extends ConsumerState with LazyLoadState with LazyLoadState with LazyLoadState