mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
other
This commit is contained in:
@@ -9,12 +9,12 @@ const Color _primaryColor = Color(0xFF299343);
|
|||||||
class ThemeViewModel extends ChangeNotifier {
|
class ThemeViewModel extends ChangeNotifier {
|
||||||
ThemeData currentTheme = lightTheme;
|
ThemeData currentTheme = lightTheme;
|
||||||
|
|
||||||
ThemeColors themeColor = LightartThemeColors();
|
ThemeColors themeColor = LightThemeColors();
|
||||||
|
|
||||||
void changeTheme() {
|
void changeTheme() {
|
||||||
if (currentTheme == darkTheme) {
|
if (currentTheme == darkTheme) {
|
||||||
currentTheme = lightTheme;
|
currentTheme = lightTheme;
|
||||||
themeColor = LightartThemeColors();
|
themeColor = LightThemeColors();
|
||||||
} else {
|
} else {
|
||||||
currentTheme = darkTheme;
|
currentTheme = darkTheme;
|
||||||
themeColor = DartThemeColors();
|
themeColor = DartThemeColors();
|
||||||
@@ -46,12 +46,17 @@ ThemeData darkTheme = ThemeData.dark().copyWith(
|
|||||||
labelColor: Color(0xffffffff),
|
labelColor: Color(0xffffffff),
|
||||||
unselectedLabelColor: Color(0xff999999),
|
unselectedLabelColor: Color(0xff999999),
|
||||||
),
|
),
|
||||||
colorScheme: const ColorScheme.light(secondary: _primaryColor,primary: _primaryColor,),
|
colorScheme: const ColorScheme.light(
|
||||||
|
secondary: _primaryColor,
|
||||||
|
primary: _primaryColor,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
ThemeData lightTheme = ThemeData.light().copyWith(
|
ThemeData lightTheme = ThemeData.light().copyWith(
|
||||||
primaryColor: _primaryColor,
|
primaryColor: _primaryColor,
|
||||||
|
colorScheme: const ColorScheme.light(
|
||||||
colorScheme: const ColorScheme.light(secondary: _primaryColor,primary: _primaryColor,),
|
secondary: _primaryColor,
|
||||||
|
primary: _primaryColor,
|
||||||
|
),
|
||||||
scaffoldBackgroundColor: Colors.white,
|
scaffoldBackgroundColor: Colors.white,
|
||||||
inputDecorationTheme: const InputDecorationTheme(
|
inputDecorationTheme: const InputDecorationTheme(
|
||||||
labelStyle: TextStyle(color: _primaryColor),
|
labelStyle: TextStyle(color: _primaryColor),
|
||||||
@@ -93,14 +98,14 @@ abstract class ThemeColors {
|
|||||||
|
|
||||||
Color descColor();
|
Color descColor();
|
||||||
|
|
||||||
Color searchBarBg();
|
Color backGround();
|
||||||
|
|
||||||
Color pinColor();
|
Color pinColor();
|
||||||
|
|
||||||
Map<String, TextStyle> codeEditorTheme();
|
Map<String, TextStyle> codeEditorTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
class LightartThemeColors extends ThemeColors {
|
class LightThemeColors extends ThemeColors {
|
||||||
@override
|
@override
|
||||||
Color taskTitleColor() {
|
Color taskTitleColor() {
|
||||||
return Color(0xff333333);
|
return Color(0xff333333);
|
||||||
@@ -125,6 +130,11 @@ class LightartThemeColors extends ThemeColors {
|
|||||||
Color descColor() {
|
Color descColor() {
|
||||||
return Color(0xff999999);
|
return Color(0xff999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color backGround() {
|
||||||
|
return Color(0xffF5F5F5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DartThemeColors extends ThemeColors {
|
class DartThemeColors extends ThemeColors {
|
||||||
@@ -152,4 +162,9 @@ class DartThemeColors extends ThemeColors {
|
|||||||
Color descColor() {
|
Color descColor() {
|
||||||
return Color(0xff999999);
|
return Color(0xff999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color backGround() {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ class _HomePageState extends ConsumerState<HomePage> {
|
|||||||
title: _title,
|
title: _title,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
),
|
),
|
||||||
body: IndexedStack(
|
body: ColoredBox(
|
||||||
|
color: ref.watch(themeProvider).themeColor.backGround(),
|
||||||
|
child: IndexedStack(
|
||||||
index: _index,
|
index: _index,
|
||||||
children: [
|
children: [
|
||||||
const Positioned.fill(
|
const Positioned.fill(
|
||||||
@@ -105,6 +107,7 @@ class _HomePageState extends ConsumerState<HomePage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: titles
|
items: titles
|
||||||
.map(
|
.map(
|
||||||
|
|||||||
@@ -1,22 +1,112 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:qinglong_app/base/ql_app_bar.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:qinglong_app/base/theme.dart';
|
||||||
|
|
||||||
class OtherPage extends StatefulWidget {
|
class OtherPage extends ConsumerStatefulWidget {
|
||||||
const OtherPage({Key? key}) : super(key: key);
|
const OtherPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_OtherPageState createState() => _OtherPageState();
|
_OtherPageState createState() => _OtherPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OtherPageState extends State<OtherPage> {
|
class _OtherPageState extends ConsumerState<OtherPage> {
|
||||||
|
var toggleValue = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 15,vertical: 15,),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10,
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"查看日志",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.taskTitleColor(),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
const Icon(
|
||||||
|
CupertinoIcons.right_chevron,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
indent: 15,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10,
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"查看日志",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.taskTitleColor(),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
const Icon(
|
||||||
|
CupertinoIcons.right_chevron,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
indent: 15,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10,
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"查看日志",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.taskTitleColor(),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
const Icon(
|
||||||
|
CupertinoIcons.right_chevron,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user