mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -67,7 +68,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
color: item.modules.moduleAuthor!.vip != null &&
|
||||
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
||||
item.modules.moduleAuthor!.vip['type'] == 2
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPalaX/grpc/app/dynamic/v2/dynamic.pb.dart' as dyn;
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -68,7 +69,7 @@ class AuthorPanelGrpc extends StatelessWidget {
|
||||
color: item.modules.first.moduleAuthor.author.vip.status >
|
||||
0 &&
|
||||
item.modules.first.moduleAuthor.author.vip.type == 2
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||
),
|
||||
|
||||
@@ -140,7 +140,7 @@ class _LiveRoomChatState extends State<LiveRoomChat> {
|
||||
TextSpan(
|
||||
text: nonMatchStr,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
@@ -153,7 +153,7 @@ class _LiveRoomChatState extends State<LiveRoomChat> {
|
||||
return TextSpan(
|
||||
text: obj['text'],
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -66,7 +66,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
_buildHeader(BuildContext context) {
|
||||
bool darken = GStorage.brightness == Brightness.dark;
|
||||
bool darken = Theme.of(context).brightness == Brightness.dark;
|
||||
String? imgUrl = darken
|
||||
? (images.nightImgurl?.isEmpty == true
|
||||
? images.imgUrl?.http2https
|
||||
@@ -123,7 +123,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
fontWeight: FontWeight.bold,
|
||||
color: (card.vip?.vipStatus ?? -1) > 0 &&
|
||||
card.vip?.vipType == 2
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: null,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPalaX/http/member.dart';
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -400,7 +401,7 @@ class _MemberPageState extends State<MemberPage>
|
||||
_memberController.memberInfo.value.vip!.status! >
|
||||
0 &&
|
||||
_memberController.memberInfo.value.vip!.type == 2
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)),
|
||||
|
||||
@@ -75,7 +75,7 @@ class MemberCoinsItem extends StatelessWidget {
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
Utils.CustomStamp_str(
|
||||
Utils.customStampStr(
|
||||
timestamp: coinItem.pubdate, date: 'MM-DD'),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:PiliPalaX/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPalaX/http/dynamics.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/member_search/controller.dart';
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:PiliPalaX/utils/grid.dart';
|
||||
import 'package:PiliPalaX/utils/id_utils.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
@@ -143,7 +144,7 @@ class SearchDynamic extends StatelessWidget {
|
||||
color: vip != null
|
||||
? (vip?['status'] ?? vip?['vipStatus']) > 0 &&
|
||||
(vip?['type'] ?? vip?['vipType']) == 2
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: null
|
||||
: null,
|
||||
fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||
|
||||
@@ -51,7 +51,7 @@ class MemberSeasonsItem extends StatelessWidget {
|
||||
bottom: 6,
|
||||
right: 6,
|
||||
type: 'gray',
|
||||
text: Utils.CustomStamp_str(
|
||||
text: Utils.customStampStr(
|
||||
timestamp: seasonItem.pubdate, date: 'YY-MM-DD'),
|
||||
)
|
||||
],
|
||||
@@ -79,7 +79,7 @@ class MemberSeasonsItem extends StatelessWidget {
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
Utils.CustomStamp_str(
|
||||
Utils.customStampStr(
|
||||
timestamp: seasonItem.pubdate, date: 'YY-MM-DD'),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPalaX/utils/global_data.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -195,7 +194,6 @@ class MineController extends GetxController {
|
||||
onChangeTheme() {
|
||||
themeType.value = nextThemeType;
|
||||
setting.put(SettingBoxKey.themeMode, themeType.value.code);
|
||||
GlobalData().themeMode = themeType.value.code;
|
||||
Get.forceAppUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// ignore_for_file: no_leading_underscores_for_local_identifiers
|
||||
|
||||
import 'package:PiliPalaX/utils/global_data.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
@@ -19,7 +17,7 @@ class MinePage extends StatefulWidget {
|
||||
|
||||
class _MinePageState extends State<MinePage> {
|
||||
final MineController mineController = Get.put(MineController())
|
||||
..themeType.value = ThemeType.values[GlobalData().themeMode];
|
||||
..themeType.value = ThemeType.values[GStorage.themeType];
|
||||
late Future _futureBuilderFuture;
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPalaX/utils/global_data.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -44,7 +43,7 @@ class SettingController extends GetxController {
|
||||
setting.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0);
|
||||
picQuality.value =
|
||||
setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10);
|
||||
themeType.value = ThemeType.values[GlobalData().themeMode];
|
||||
themeType.value = ThemeType.values[GStorage.themeType];
|
||||
dynamicBadgeType.value = DynamicBadgeMode.values[setting.get(
|
||||
SettingBoxKey.dynamicBadgeMode,
|
||||
defaultValue: DynamicBadgeMode.number.code)];
|
||||
|
||||
@@ -308,7 +308,6 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
_tempThemeValue = result;
|
||||
settingController.themeType.value = result;
|
||||
setting.put(SettingBoxKey.themeMode, result.index);
|
||||
GlobalData().themeMode = result.index;
|
||||
Get.forceAppUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -366,7 +366,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
.vip
|
||||
.type ==
|
||||
2
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: null,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPalaX/common/widgets/imageview.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -192,7 +193,7 @@ class ReplyItem extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
color: (replyItem!.member!.vip!['vipStatus'] > 0 &&
|
||||
replyItem!.member!.vip!['vipType'] == 2)
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize: 13,
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPalaX/common/widgets/imageview.dart';
|
||||
import 'package:PiliPalaX/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
import 'package:PiliPalaX/pages/video/detail/reply/widgets/zan_grpc.dart';
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -202,7 +203,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
color: (replyItem.member.vipStatus > 0 &&
|
||||
replyItem.member.vipType == 2)
|
||||
? Utils.vipColor
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize: 13,
|
||||
),
|
||||
|
||||
@@ -568,7 +568,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
: plPlayerController.subtitleFontScale.value),
|
||||
letterSpacing: 0.1,
|
||||
wordSpacing: 0.1,
|
||||
color: Color(0xffffffff),
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
backgroundColor: Color(0xaa000000),
|
||||
);
|
||||
@@ -865,7 +865,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
: _volumeValue.value < 0.5
|
||||
? Icons.volume_down
|
||||
: Icons.volume_up,
|
||||
color: const Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
size: 20.0,
|
||||
),
|
||||
const SizedBox(width: 2.0),
|
||||
@@ -873,7 +873,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
'${(_volumeValue.value * 100.0).round()}%',
|
||||
style: const TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -911,7 +911,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
: _brightnessValue.value < 2.0 / 3.0
|
||||
? Icons.brightness_medium
|
||||
: Icons.brightness_high,
|
||||
color: const Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
size: 18.0,
|
||||
),
|
||||
const SizedBox(width: 2.0),
|
||||
@@ -919,7 +919,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
'${(_brightnessValue.value * 100.0).round()}%',
|
||||
style: const TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -65,14 +65,14 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
const Icon(
|
||||
Icons.fast_rewind,
|
||||
size: 24.0,
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快退${value.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -65,14 +65,14 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
const Icon(
|
||||
Icons.fast_forward,
|
||||
size: 24.0,
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快进${value.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Color(0xFFFFFFFF),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -54,3 +54,11 @@ extension StringExt on String {
|
||||
extension boolExt on bool {
|
||||
bool get not => !this;
|
||||
}
|
||||
|
||||
extension BuildContextExt on BuildContext {
|
||||
Color get vipColor {
|
||||
return Theme.of(this).brightness == Brightness.light
|
||||
? const Color(0xFFFF6699)
|
||||
: const Color(0xFFD44E7D);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class GlobalData {
|
||||
int imgQuality = 10;
|
||||
|
||||
int themeMode = 2;
|
||||
// int themeMode = 2;
|
||||
|
||||
bool grpcReply = true;
|
||||
|
||||
|
||||
@@ -125,21 +125,24 @@ class GStorage {
|
||||
static MemberTabType get memberTab => MemberTabType
|
||||
.values[setting.get(SettingBoxKey.memberTab, defaultValue: 0)];
|
||||
|
||||
static int get themeType =>
|
||||
setting.get(SettingBoxKey.themeMode, defaultValue: ThemeType.system.code);
|
||||
|
||||
static ThemeMode get themeMode {
|
||||
return switch (GlobalData().themeMode) {
|
||||
return switch (themeType) {
|
||||
0 => ThemeMode.light,
|
||||
1 => ThemeMode.dark,
|
||||
_ => ThemeMode.system
|
||||
};
|
||||
}
|
||||
|
||||
static Brightness get brightness {
|
||||
return switch (GlobalData().themeMode) {
|
||||
0 => Brightness.light,
|
||||
1 => Brightness.dark,
|
||||
_ => PlatformDispatcher.instance.platformBrightness
|
||||
};
|
||||
}
|
||||
// static Brightness get brightness {
|
||||
// return switch (_themeMode) {
|
||||
// 0 => Brightness.light,
|
||||
// 1 => Brightness.dark,
|
||||
// _ => PlatformDispatcher.instance.platformBrightness
|
||||
// };
|
||||
// }
|
||||
|
||||
static Future<void> init() async {
|
||||
final Directory dir = await getApplicationSupportDirectory();
|
||||
@@ -176,10 +179,10 @@ class GStorage {
|
||||
SettingBoxKey.defaultPicQa,
|
||||
defaultValue: 10,
|
||||
);
|
||||
GlobalData().themeMode = setting.get(
|
||||
SettingBoxKey.themeMode,
|
||||
defaultValue: ThemeType.system.code,
|
||||
);
|
||||
// GlobalData().themeMode = setting.get(
|
||||
// SettingBoxKey.themeMode,
|
||||
// defaultValue: ThemeType.system.code,
|
||||
// );
|
||||
GlobalData().grpcReply = grpcReply;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// 工具函数
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
@@ -13,7 +10,6 @@ import 'package:PiliPalaX/models/bangumi/info.dart';
|
||||
import 'package:PiliPalaX/models/common/search_type.dart';
|
||||
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/group_panel.dart';
|
||||
import 'package:PiliPalaX/utils/feed_back.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -369,12 +365,6 @@ class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static Color get vipColor {
|
||||
return GStorage.brightness == Brightness.light
|
||||
? const Color(0xFFFF6699)
|
||||
: const Color(0xFFD44E7D);
|
||||
}
|
||||
|
||||
static Future<String> getCookiePath() async {
|
||||
final Directory tempDir = await getApplicationSupportDirectory();
|
||||
final String tempPath = "${tempDir.path}/.plpl/";
|
||||
@@ -542,17 +532,17 @@ class Utils {
|
||||
if (formatType == 'detail') {
|
||||
currentYearStr = 'MM-DD hh:mm';
|
||||
lastYearStr = 'YY-MM-DD hh:mm';
|
||||
return CustomStamp_str(
|
||||
return customStampStr(
|
||||
timestamp: timeStamp, date: lastYearStr, toInt: false);
|
||||
} else if (formatType == 'day') {
|
||||
if (distance <= 43200) {
|
||||
return CustomStamp_str(
|
||||
return customStampStr(
|
||||
timestamp: timeStamp,
|
||||
date: 'hh:mm',
|
||||
toInt: true,
|
||||
);
|
||||
}
|
||||
return CustomStamp_str(
|
||||
return customStampStr(
|
||||
timestamp: timeStamp,
|
||||
date: 'YY-MM-DD',
|
||||
toInt: true,
|
||||
@@ -566,16 +556,16 @@ class Utils {
|
||||
return '${(distance / 60 / 60).floor()}小时前';
|
||||
} else if (DateTime.fromMillisecondsSinceEpoch(time * 1000).year ==
|
||||
DateTime.fromMillisecondsSinceEpoch(timeStamp * 1000).year) {
|
||||
return CustomStamp_str(
|
||||
return customStampStr(
|
||||
timestamp: timeStamp, date: currentYearStr, toInt: false);
|
||||
} else {
|
||||
return CustomStamp_str(
|
||||
return customStampStr(
|
||||
timestamp: timeStamp, date: lastYearStr, toInt: false);
|
||||
}
|
||||
}
|
||||
|
||||
// 时间戳转时间
|
||||
static String CustomStamp_str({
|
||||
static String customStampStr({
|
||||
int? timestamp, // 为空则显示当前时间
|
||||
String? date, // 显示格式,比如:'YY年MM月DD日 hh:mm:ss'
|
||||
bool toInt = true, // 去除0开头
|
||||
@@ -587,8 +577,11 @@ class Utils {
|
||||
dynamic dateArr = timeStr.split(' ')[0];
|
||||
dynamic timeArr = timeStr.split(' ')[1];
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
String YY = dateArr.split('-')[0];
|
||||
// ignore: non_constant_identifier_names
|
||||
String MM = dateArr.split('-')[1];
|
||||
// ignore: non_constant_identifier_names
|
||||
String DD = dateArr.split('-')[2];
|
||||
|
||||
String hh = timeArr.split(':')[0];
|
||||
|
||||
Reference in New Issue
Block a user