add theme color

This commit is contained in:
jyuesong
2022-01-14 09:40:58 +08:00
parent b0357b0827
commit 572deec31b
37 changed files with 334 additions and 261 deletions

View File

@@ -43,8 +43,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.qinglong_app"
minSdkVersion flutter.minSdkVersion
applicationId "work.master.qinglongapp"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.qinglong_app">
package="work.master.qinglongapp">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -1,7 +1,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.qinglong_app">
package="work.master.qinglongapp">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="qinglong_app"
android:label="青龙"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity

View File

@@ -1,4 +1,4 @@
package com.example.qinglong_app
package work.master.qinglongapp
import io.flutter.embedding.android.FlutterActivity

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.qinglong_app">
package="work.master.qinglongapp">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

BIN
assets/images/login_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
assets/images/login_tip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>qinglong_app</string>
<string>青龙</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
var themeProvider = ChangeNotifierProvider((ref) => ThemeViewModel());
const Color _primaryColor = Color(0xFF299343);
class ThemeViewModel extends ChangeNotifier {
ThemeData currentTheme = lightTheme;
@@ -25,8 +26,29 @@ ThemeData darkTheme = ThemeData.dark().copyWith(
primaryColor: const Color(0xffffffff),
);
ThemeData lightTheme = ThemeData.light().copyWith(
primaryColor: const Color(0xFF0F77FE),
primaryColor: _primaryColor,
scaffoldBackgroundColor: Colors.white,
inputDecorationTheme: const InputDecorationTheme(
labelStyle: TextStyle(color: _primaryColor),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: _primaryColor,
),
),
),
appBarTheme: const AppBarTheme(
backgroundColor: _primaryColor,
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedItemColor: _primaryColor,
),
buttonTheme: const ButtonThemeData(
buttonColor: _primaryColor,
),
progressIndicatorTheme: const ProgressIndicatorThemeData(
color: _primaryColor,
),
);
abstract class ThemeColors {

View File

@@ -57,7 +57,13 @@ class _ConfigPageState extends State<ConfigPage> {
),
const Spacer(),
CupertinoButton(
child: const Text("编辑"),
child: Text(
"编辑",
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 16,
),
),
onPressed: () {
Navigator.of(context).pushNamed(Routes.route_ConfigEdit, arguments: {
"title": model.title,

View File

@@ -44,53 +44,76 @@ class _LoginPageState extends State<LoginPage> {
}
return SizedBox(
height: MediaQuery.of(context).size.height,
child: SingleChildScrollView(
child: Stack(
children: [
Positioned(
bottom: 0,
child: Image.asset(
"assets/images/login_bg.png",
width: MediaQuery.of(context).size.width,
),
),
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 40,
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: MediaQuery.of(context).size.height / 6,
),
Image.asset(
"assets/images/ql.png",
width: 60,
height: 60,
),
SizedBox(
height: 15,
height: 50,
width: MediaQuery.of(context).size.width,
child: Stack(
children: [
Positioned(
top: 0,
left: 40,
child: Image.asset(
"assets/images/login_tip.png",
height: 45,
),
Text(
"青龙控制面板",
),
const Positioned(
top: 10,
left: 40,
child: Text(
"登录",
style: TextStyle(
fontSize: 16,
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
top: 5,
right: 40,
child: Image.asset(
"assets/images/ql.png",
height: 45,
),
),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.height / 10,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
),
child: Row(
children: [
const SizedBox(
child: Text(
const Text(
"域名:",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
width: 60,
),
const SizedBox(
width: 15,
height: 10,
),
Expanded(
child: TextField(
TextField(
onChanged: (_) {
setState(() {});
},
@@ -101,31 +124,20 @@ class _LoginPageState extends State<LoginPage> {
),
autofocus: false,
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
),
child: Row(
children: [
const SizedBox(
child: Text(
height: 20,
),
const Text(
"用户名:",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
width: 60,
),
const SizedBox(
width: 15,
height: 10,
),
Expanded(
child: TextField(
TextField(
onChanged: (_) {
setState(() {});
},
@@ -136,32 +148,20 @@ class _LoginPageState extends State<LoginPage> {
),
autofocus: false,
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
child: Row(
children: [
const SizedBox(
child: Text(
height: 20,
),
const Text(
"密码:",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
width: 60,
),
const SizedBox(
width: 15,
height: 10,
),
Expanded(
child: TextField(
TextField(
onChanged: (_) {
setState(() {});
},
@@ -173,26 +173,24 @@ class _LoginPageState extends State<LoginPage> {
),
autofocus: false,
),
),
],
),
),
const SizedBox(
height: 30,
),
SizedBox(
width: MediaQuery.of(context).size.width - 30,
width: MediaQuery.of(context).size.width - 80,
child: IgnorePointer(
ignoring: _hostController.text.isEmpty || _userNameController.text.isEmpty || _passwordController.text.isEmpty || model.isLoading,
child: CupertinoButton(
color:
(_hostController.text.isNotEmpty && _userNameController.text.isNotEmpty && _passwordController.text.isNotEmpty && !model.isLoading)
color: (_hostController.text.isNotEmpty &&
_userNameController.text.isNotEmpty &&
_passwordController.text.isNotEmpty &&
!model.isLoading)
? Theme.of(context).primaryColor
: Theme.of(context).primaryColor.withOpacity(0.4),
child: model.isLoading
? const CupertinoActivityIndicator()
: const Text(
"登录",
" ",
style: TextStyle(
fontSize: 16,
),
@@ -207,6 +205,10 @@ class _LoginPageState extends State<LoginPage> {
],
),
),
),
],
),
);
}),
);

View File

@@ -83,7 +83,7 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
"名称:",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
const SizedBox(
@@ -115,7 +115,7 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
"命令:",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
const SizedBox(
@@ -149,7 +149,7 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
"定时:",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
const SizedBox(

View File

@@ -31,6 +31,7 @@ class _TaskPageState extends State<TaskPage> {
return BaseStateWidget<TaskViewModel>(
builder: (ref, model, child) {
return RefreshIndicator(
color: Theme.of(context).primaryColor,
onRefresh: () async {
return model.loadData(false);
},
@@ -106,7 +107,11 @@ class TaskItemCell extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Slidable(
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Slidable(
key: const ValueKey(0),
startActionPane: ActionPane(
motion: const ScrollMotion(),
@@ -214,6 +219,9 @@ class TaskItemCell extends StatelessWidget {
],
),
),
),
const Divider(height: 1,indent: 15,),
],
);
}

View File

@@ -38,9 +38,7 @@ class TaskViewModel extends BaseViewModel {
list.sort((a, b) {
return a.status!.compareTo(b.status!);
});
list.sort((a, b) {
return b.isPinned!.compareTo(a.isPinned!);
});
}
Future<void> runCrons(String cron) async {

View File

@@ -106,6 +106,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "8.1.3"
change_app_package_name:
dependency: "direct dev"
description:
name: change_app_package_name
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
characters:
dependency: transitive
description:
@@ -237,6 +244,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_app_name:
dependency: "direct dev"
description:
name: flutter_app_name
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1"
flutter_highlight:
dependency: transitive
description:
@@ -244,6 +258,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.0"
flutter_launcher_icons:
dependency: "direct dev"
description:
name: flutter_launcher_icons
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.2"
flutter_lints:
dependency: "direct dev"
description:
@@ -252,7 +273,7 @@ packages:
source: hosted
version: "1.0.4"
flutter_native_splash:
dependency: "direct main"
dependency: "direct dev"
description:
name: flutter_native_splash
url: "https://pub.flutter-io.cn"

View File

@@ -23,8 +23,13 @@ dependencies:
logger: ^1.1.0
intl: ^0.17.0
code_editor: ^1.3.1
flutter_native_splash: ^1.3.3
dev_dependencies:
flutter_native_splash: ^1.3.3
flutter_launcher_icons: ^0.9.2
change_app_package_name: ^0.1.3
flutter_app_name: ^0.1.0
build_runner: ^2.0.0
json_conversion: ^0.0.4
flutter_test:
@@ -39,6 +44,15 @@ flutter:
assets:
- assets/images/
flutter_app_name:
name: "青龙"
flutter_icons:
image_path_android: "assets/images/ql.png"
image_path_ios: "assets/images/ql.png"
android: true # can specify file name here e.g. "ic_launcher"
ios: true # can specify file name here e.g. "My-Launcher-Icon"
flutter_native_splash: