show charging label

tweak

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-10 17:22:15 +08:00
parent a9ceb04d07
commit 3ee8c68eac
7 changed files with 157 additions and 100 deletions

View File

@@ -52,6 +52,7 @@ class LaterItemModel with MultiSelectData {
int? missionId; int? missionId;
String? firstFrame; String? firstFrame;
int? seasonId; int? seasonId;
bool? isCharging;
LaterItemModel({ LaterItemModel({
this.aid, this.aid,
@@ -98,6 +99,7 @@ class LaterItemModel with MultiSelectData {
this.missionId, this.missionId,
this.firstFrame, this.firstFrame,
this.seasonId, this.seasonId,
this.isCharging,
}); });
factory LaterItemModel.fromJson(Map<String, dynamic> json) => LaterItemModel( factory LaterItemModel.fromJson(Map<String, dynamic> json) => LaterItemModel(
@@ -155,10 +157,11 @@ class LaterItemModel with MultiSelectData {
enableVt: json['enable_vt'] as int?, enableVt: json['enable_vt'] as int?,
viewText1: json['view_text_1'] as String?, viewText1: json['view_text_1'] as String?,
isPgc: json['is_pgc'] as bool?, isPgc: json['is_pgc'] as bool?,
pgcLabel: json['pgc_label'] as String?, pgcLabel: json['pgc_label'] == '' ? null : json['pgc_label'],
isPugv: json['is_pugv'] as bool?, isPugv: json['is_pugv'] as bool?,
missionId: json['mission_id'] as int?, missionId: json['mission_id'] as int?,
firstFrame: json['first_frame'] as String?, firstFrame: json['first_frame'] as String?,
seasonId: json['season_id'] as int?, seasonId: json['season_id'] as int?,
isCharging: json['charging_pay']?['level'] != null,
); );
} }

View File

@@ -60,6 +60,7 @@ class _AboutPageState extends State<AboutPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
const style = TextStyle(fontSize: 15);
final outline = theme.colorScheme.outline; final outline = theme.colorScheme.outline;
final subTitleStyle = TextStyle(fontSize: 13, color: outline); final subTitleStyle = TextStyle(fontSize: 13, color: outline);
return Scaffold( return Scaffold(
@@ -222,7 +223,8 @@ Commit Hash: ${BuildConfig.commitHash}''',
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
children: [ children: [
ListTile( ListTile(
title: const Text('导出'), dense: true,
title: const Text('导出', style: style),
onTap: () { onTap: () {
Get.back(); Get.back();
String res = jsonEncode(Accounts.account.toMap()); String res = jsonEncode(Accounts.account.toMap());
@@ -230,7 +232,8 @@ Commit Hash: ${BuildConfig.commitHash}''',
}, },
), ),
ListTile( ListTile(
title: const Text('导入'), dense: true,
title: const Text('导入', style: style),
onTap: () async { onTap: () async {
Get.back(); Get.back();
ClipboardData? data = ClipboardData? data =
@@ -302,7 +305,8 @@ Commit Hash: ${BuildConfig.commitHash}''',
title: const Text('导入/导出设置'), title: const Text('导入/导出设置'),
children: [ children: [
ListTile( ListTile(
title: const Text('导出设置至剪贴板'), dense: true,
title: const Text('导出设置至剪贴板', style: style),
onTap: () { onTap: () {
Get.back(); Get.back();
String data = GStorage.exportAllSettings(); String data = GStorage.exportAllSettings();
@@ -310,7 +314,8 @@ Commit Hash: ${BuildConfig.commitHash}''',
}, },
), ),
ListTile( ListTile(
title: const Text('从剪贴板导入设置'), dense: true,
title: const Text('从剪贴板导入设置', style: style),
onTap: () async { onTap: () async {
Get.back(); Get.back();
ClipboardData? data = ClipboardData? data =
@@ -368,16 +373,13 @@ Commit Hash: ${BuildConfig.commitHash}''',
onTap: () => showDialog( onTap: () => showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return AlertDialog( return SimpleDialog(
title: const Text('重置所有设置'), clipBehavior: Clip.hardEdge,
content: const Text('是否重置所有设置?'), title: const Text('是否重置所有设置?'),
actions: [ children: [
TextButton( ListTile(
onPressed: Get.back, dense: true,
child: const Text('取消'), onTap: () async {
),
TextButton(
onPressed: () async {
Get.back(); Get.back();
await Future.wait([ await Future.wait([
GStorage.setting.clear(), GStorage.setting.clear(),
@@ -385,10 +387,11 @@ Commit Hash: ${BuildConfig.commitHash}''',
]); ]);
SmartDialog.showToast('重置成功'); SmartDialog.showToast('重置成功');
}, },
child: const Text('重置可导出的设置'), title: const Text('重置可导出的设置', style: style),
), ),
TextButton( ListTile(
onPressed: () async { dense: true,
onTap: () async {
Get.back(); Get.back();
await Future.wait([ await Future.wait([
GStorage.userInfo.clear(), GStorage.userInfo.clear(),
@@ -400,7 +403,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
]); ]);
SmartDialog.showToast('重置成功'); SmartDialog.showToast('重置成功');
}, },
child: const Text('重置所有数据(含登录信息)'), title: const Text('重置所有数据(含登录信息)', style: style),
), ),
], ],
); );

View File

@@ -20,7 +20,13 @@ class HistoryBaseController extends GetxController {
title: const Text('提示'), title: const Text('提示'),
content: const Text('啊叻?你要清空历史记录功能吗?'), content: const Text('啊叻?你要清空历史记录功能吗?'),
actions: [ actions: [
TextButton(onPressed: Get.back, child: const Text('取消')), TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton( TextButton(
onPressed: () async { onPressed: () async {
Get.back(); Get.back();
@@ -33,7 +39,7 @@ class HistoryBaseController extends GetxController {
} }
}, },
child: const Text('确认清空'), child: const Text('确认清空'),
) ),
], ],
); );
}, },
@@ -50,7 +56,13 @@ class HistoryBaseController extends GetxController {
content: content:
Text(!pauseStatus.value ? '啊叻?你要暂停历史记录功能吗?' : '啊叻?要恢复历史记录功能吗?'), Text(!pauseStatus.value ? '啊叻?你要暂停历史记录功能吗?' : '啊叻?要恢复历史记录功能吗?'),
actions: [ actions: [
TextButton(onPressed: Get.back, child: const Text('取消')), TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton( TextButton(
onPressed: () async { onPressed: () async {
SmartDialog.showLoading(msg: '请求中'); SmartDialog.showLoading(msg: '请求中');
@@ -66,7 +78,7 @@ class HistoryBaseController extends GetxController {
Get.back(); Get.back();
}, },
child: Text(!pauseStatus.value ? '确认暂停' : '确认恢复'), child: Text(!pauseStatus.value ? '确认暂停' : '确认恢复'),
) ),
], ],
); );
}, },

View File

@@ -94,6 +94,14 @@ class VideoCardHLater extends StatelessWidget {
width: maxWidth, width: maxWidth,
height: maxHeight, height: maxHeight,
), ),
if (videoItem.isCharging == true)
const PBadge(
text: '充电专属',
top: 6.0,
right: 6.0,
type: PBadgeType.error,
)
else if (videoItem.pgcLabel != null)
PBadge( PBadge(
text: videoItem.pgcLabel, text: videoItem.pgcLabel,
top: 6.0, top: 6.0,

View File

@@ -85,7 +85,10 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
actions: [ actions: [
TextButton( TextButton(
onPressed: Get.back, onPressed: Get.back,
child: const Text('取消'), child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {

View File

@@ -132,10 +132,9 @@ class _VideoInfoState extends State<VideoInfo> {
late final _horizontalMemberPage = Pref.horizontalMemberPage; late final _horizontalMemberPage = Pref.horizontalMemberPage;
Widget _buildVideoTitle(ThemeData theme, [bool isExpand = false]) => Widget _buildVideoTitle(ThemeData theme, [bool isExpand = false]) {
videoDetailCtr.plPlayerController.enableSponsorBlock late final isDark = theme.brightness == Brightness.dark;
? Obx( Widget child() => Text.rich(
() => Text.rich(
TextSpan( TextSpan(
children: [ children: [
if (videoDetailCtr.videoLabel.value.isNotEmpty) ...[ if (videoDetailCtr.videoLabel.value.isNotEmpty) ...[
@@ -148,8 +147,7 @@ class _VideoInfoState extends State<VideoInfo> {
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.secondaryContainer, color: theme.colorScheme.secondaryContainer,
borderRadius: borderRadius: const BorderRadius.all(Radius.circular(4)),
const BorderRadius.all(Radius.circular(4)),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -161,22 +159,19 @@ class _VideoInfoState extends State<VideoInfo> {
Icon( Icon(
Icons.shield_outlined, Icons.shield_outlined,
size: 16, size: 16,
color: color: theme.colorScheme.onSecondaryContainer,
theme.colorScheme.onSecondaryContainer,
), ),
Icon( Icon(
Icons.play_arrow_rounded, Icons.play_arrow_rounded,
size: 12, size: 12,
color: color: theme.colorScheme.onSecondaryContainer,
theme.colorScheme.onSecondaryContainer,
), ),
], ],
), ),
Text( Text(
videoDetailCtr.videoLabel.value, videoDetailCtr.videoLabel.value,
textScaler: TextScaler.noScaling, textScaler: TextScaler.noScaling,
strutStyle: strutStyle: const StrutStyle(leading: 0, height: 1),
const StrutStyle(leading: 0, height: 1),
style: TextStyle( style: TextStyle(
height: 1, height: 1,
fontSize: 13, fontSize: 13,
@@ -189,22 +184,50 @@ class _VideoInfoState extends State<VideoInfo> {
), ),
const TextSpan(text: ' '), const TextSpan(text: ' '),
], ],
if (videoDetail.isUpowerExclusive == true) ...[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
decoration: BoxDecoration(
color: isDark
? theme.colorScheme.error
: theme.colorScheme.errorContainer,
borderRadius: const BorderRadius.all(Radius.circular(4)),
),
child: Text(
'充电专属',
textScaler: TextScaler.noScaling,
strutStyle: const StrutStyle(leading: 0, height: 1),
style: TextStyle(
height: 1,
fontSize: 12,
fontWeight: FontWeight.bold,
color: isDark
? theme.colorScheme.onError
: theme.colorScheme.onErrorContainer,
),
),
),
),
const TextSpan(text: ' '),
],
TextSpan( TextSpan(
text: text: '${videoDetail.title ?? videoItem['title'] ?? ''}'),
'${videoDetail.title ?? videoItem['title'] ?? ''}'),
], ],
), ),
maxLines: isExpand ? null : 2, maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis, overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16), style: const TextStyle(fontSize: 16),
),
)
: Text(
'${videoDetail.title ?? videoItem['title'] ?? ''}',
maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
); );
if (videoDetailCtr.plPlayerController.enableSponsorBlock) {
return Obx(child);
}
return child();
}
Future<void> handleState(FutureOr Function() action) async { Future<void> handleState(FutureOr Function() action) async {
if (!isProcessing) { if (!isProcessing) {

View File

@@ -239,7 +239,12 @@ class _WebviewPageState extends State<WebviewPage> {
actions: [ actions: [
TextButton( TextButton(
onPressed: Get.back, onPressed: Get.back,
child: const Text('取消'), child: Text(
'取消',
style: TextStyle(
color:
Theme.of(context).colorScheme.outline),
),
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {