mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
优化搜索框样式,优化任务列表,环境变量等相关页面使用体验
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qinglong_app/module/change_account_page.dart';
|
||||
import 'package:qinglong_app/module/config/config_edit_page.dart';
|
||||
import 'package:qinglong_app/module/env/add_env_page.dart';
|
||||
import 'package:qinglong_app/module/env/env_bean.dart';
|
||||
@@ -41,6 +42,7 @@ class Routes {
|
||||
static const String routeUpdatePassword = "/updatePassword";
|
||||
static const String routeAbout = "/about";
|
||||
static const String routeTheme = "/theme";
|
||||
static const String routeChangeAccount = "/changeAccount";
|
||||
|
||||
static Route<dynamic>? generateRoute(RouteSettings settings) {
|
||||
switch (settings.name) {
|
||||
@@ -55,7 +57,10 @@ class Routes {
|
||||
} else {
|
||||
return MaterialPageRoute(builder: (context) => const LoginPage());
|
||||
}
|
||||
|
||||
case routeChangeAccount:
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) => const ChangeAccountPage(),
|
||||
);
|
||||
case routeAddTask:
|
||||
if (settings.arguments != null) {
|
||||
return CupertinoPageRoute(
|
||||
@@ -66,8 +71,7 @@ class Routes {
|
||||
return CupertinoPageRoute(builder: (context) => const AddTaskPage());
|
||||
}
|
||||
case routeAddDependency:
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) => const AddDependencyPage());
|
||||
return CupertinoPageRoute(builder: (context) => const AddDependencyPage());
|
||||
case routeAddEnv:
|
||||
if (settings.arguments != null) {
|
||||
return CupertinoPageRoute(
|
||||
|
||||
@@ -69,7 +69,7 @@ class ThemeViewModel extends ChangeNotifier {
|
||||
secondary: _primaryColor,
|
||||
primary: _primaryColor,
|
||||
),
|
||||
scaffoldBackgroundColor: const Color(0xfff5f5f5),
|
||||
scaffoldBackgroundColor: const Color(0xffffffff),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
labelStyle: TextStyle(
|
||||
color: _primaryColor,
|
||||
@@ -223,6 +223,8 @@ abstract class ThemeColors {
|
||||
|
||||
Color tabBarColor();
|
||||
|
||||
Color blackAndWhite();
|
||||
|
||||
Color pinColor();
|
||||
|
||||
Color buttonBgColor();
|
||||
@@ -241,6 +243,11 @@ class LightThemeColors extends ThemeColors {
|
||||
return const Color(0xffF7F7F7);
|
||||
}
|
||||
|
||||
@override
|
||||
Color blackAndWhite() {
|
||||
return Colors.white;
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, TextStyle> codeEditorTheme() {
|
||||
return qinglongLightTheme;
|
||||
@@ -288,6 +295,11 @@ class DartThemeColors extends ThemeColors {
|
||||
return qinglongDarkTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Color blackAndWhite() {
|
||||
return Colors.black;
|
||||
}
|
||||
|
||||
@override
|
||||
Color descColor() {
|
||||
return const Color(0xff999999);
|
||||
|
||||
69
lib/base/ui/search_cell.dart
Normal file
69
lib/base/ui/search_cell.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../theme.dart';
|
||||
|
||||
class SearchCell extends ConsumerStatefulWidget {
|
||||
final TextEditingController controller;
|
||||
|
||||
const SearchCell({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
ConsumerState createState() => _SearchCellState();
|
||||
}
|
||||
|
||||
class _SearchCellState extends ConsumerState<SearchCell> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoSearchTextField(
|
||||
decoration: BoxDecoration(
|
||||
color: ref.watch(themeProvider).themeColor.blackAndWhite(),
|
||||
border: Border.all(width: 1, color: const Color(0xffC0C4CC)),
|
||||
borderRadius: BorderRadius.circular(
|
||||
7,
|
||||
),
|
||||
),
|
||||
onSuffixTap: () {
|
||||
widget.controller.text = "";
|
||||
setState(() {
|
||||
|
||||
});
|
||||
},
|
||||
controller: widget.controller,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5,
|
||||
vertical: 5,
|
||||
),
|
||||
suffixInsets: const EdgeInsets.only(
|
||||
right: 15,
|
||||
),
|
||||
prefixIcon: Image.asset(
|
||||
"assets/images/icon_search.png",
|
||||
width: 18,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
prefixInsets: const EdgeInsets.only(
|
||||
left: 10,
|
||||
top: 2,
|
||||
),
|
||||
placeholderStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
placeholder: "请输入内容",
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user