mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
add setting
This commit is contained in:
@@ -98,13 +98,13 @@ class Api {
|
||||
return await Http.delete<NullResponse>(Url.DEL_ENV, [id]);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<EnvBean>> addEnv(String value, String name, String remarks, {String? id}) async {
|
||||
var data = {"value": name, "remarks": remarks, "name": name};
|
||||
static Future<HttpResponse<NullResponse>> addEnv(String name, String value, String remarks, {String? id}) async {
|
||||
var data = {"value": value, "remarks": remarks, "name": name};
|
||||
|
||||
if (id != null) {
|
||||
data["_id"] = id;
|
||||
return await Http.put<EnvBean>(Url.ADD_ENV, data);
|
||||
return await Http.put<NullResponse>(Url.ADD_ENV, data);
|
||||
}
|
||||
return await Http.post<EnvBean>(Url.ADD_ENV, data);
|
||||
return await Http.post<NullResponse>(Url.ADD_ENV, [data]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class Http {
|
||||
if (e.response?.statusCode == 401) {
|
||||
exitLogin();
|
||||
}
|
||||
return HttpResponse(success: false, message: e.message, code: 0);
|
||||
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class Http {
|
||||
if (e.response?.statusCode == 401) {
|
||||
exitLogin();
|
||||
}
|
||||
return HttpResponse(success: false, message: e.message, code: 0);
|
||||
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class Http {
|
||||
if (e.response?.statusCode == 401) {
|
||||
exitLogin();
|
||||
}
|
||||
return HttpResponse(success: false, message: e.message, code: 0);
|
||||
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class Http {
|
||||
if (e.response?.statusCode == 401) {
|
||||
exitLogin();
|
||||
}
|
||||
return HttpResponse(success: false, message: e.message, code: 0);
|
||||
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ class TokenInterceptor extends Interceptor {
|
||||
if (getIt<UserInfoViewModel>().token != null && getIt<UserInfoViewModel>().token!.isNotEmpty) {
|
||||
options.headers["Authorization"] = "Bearer " + getIt<UserInfoViewModel>().token!;
|
||||
}
|
||||
|
||||
options.headers["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
||||
options.headers["Content-Type"] = "application/json;charset=UTF-8";
|
||||
options.queryParameters["t"] = (DateTime.now().millisecondsSinceEpoch~/1000).toString();
|
||||
return handler.next(options);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,15 @@ class ThemeViewModel extends ChangeNotifier {
|
||||
}
|
||||
|
||||
ThemeData darkTheme = ThemeData.dark().copyWith(
|
||||
brightness: Brightness.dark,
|
||||
primaryColor: const Color(0xffffffff),
|
||||
scaffoldBackgroundColor: Colors.black,
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: Colors.black,
|
||||
titleTextStyle: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
labelStyle: TextStyle(color: _primaryColor),
|
||||
@@ -70,6 +76,7 @@ ThemeData darkTheme = ThemeData.dark().copyWith(
|
||||
),
|
||||
);
|
||||
ThemeData lightTheme = ThemeData.light().copyWith(
|
||||
brightness: Brightness.light,
|
||||
primaryColor: _primaryColor,
|
||||
colorScheme: const ColorScheme.light(
|
||||
secondary: _primaryColor,
|
||||
@@ -86,6 +93,10 @@ ThemeData lightTheme = ThemeData.light().copyWith(
|
||||
),
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: _primaryColor,
|
||||
titleTextStyle: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
||||
selectedItemColor: _primaryColor,
|
||||
@@ -120,13 +131,15 @@ abstract class ThemeColors {
|
||||
|
||||
Color pinColor();
|
||||
|
||||
Color buttonBgColor();
|
||||
|
||||
Map<String, TextStyle> codeEditorTheme();
|
||||
}
|
||||
|
||||
class LightThemeColors extends ThemeColors {
|
||||
@override
|
||||
Color taskTitleColor() {
|
||||
return Color(0xff333333);
|
||||
return const Color(0xff333333);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -141,13 +154,18 @@ class LightThemeColors extends ThemeColors {
|
||||
|
||||
@override
|
||||
Color descColor() {
|
||||
return Color(0xff999999);
|
||||
return const Color(0xff999999);
|
||||
}
|
||||
|
||||
@override
|
||||
Color settingBgColor() {
|
||||
return Colors.white;
|
||||
}
|
||||
|
||||
@override
|
||||
Color buttonBgColor() {
|
||||
return _primaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
class DartThemeColors extends ThemeColors {
|
||||
@@ -168,11 +186,16 @@ class DartThemeColors extends ThemeColors {
|
||||
|
||||
@override
|
||||
Color descColor() {
|
||||
return Color(0xff999999);
|
||||
return const Color(0xff999999);
|
||||
}
|
||||
|
||||
@override
|
||||
Color settingBgColor() {
|
||||
return Colors.black;
|
||||
}
|
||||
|
||||
@override
|
||||
Color buttonBgColor() {
|
||||
return const Color(0xff333333);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user