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

View File

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

View File

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

View File

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

View File

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

View File

@@ -132,79 +132,102 @@ class _VideoInfoState extends State<VideoInfo> {
late final _horizontalMemberPage = Pref.horizontalMemberPage;
Widget _buildVideoTitle(ThemeData theme, [bool isExpand = false]) =>
videoDetailCtr.plPlayerController.enableSponsorBlock
? Obx(
() => Text.rich(
TextSpan(
children: [
if (videoDetailCtr.videoLabel.value.isNotEmpty) ...[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
decoration: BoxDecoration(
color: theme.colorScheme.secondaryContainer,
borderRadius:
const BorderRadius.all(Radius.circular(4)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [
Icon(
Icons.shield_outlined,
size: 16,
color:
theme.colorScheme.onSecondaryContainer,
),
Icon(
Icons.play_arrow_rounded,
size: 12,
color:
theme.colorScheme.onSecondaryContainer,
),
],
),
Text(
videoDetailCtr.videoLabel.value,
textScaler: TextScaler.noScaling,
strutStyle:
const StrutStyle(leading: 0, height: 1),
style: TextStyle(
height: 1,
fontSize: 13,
color: theme.colorScheme.onSecondaryContainer,
),
),
],
Widget _buildVideoTitle(ThemeData theme, [bool isExpand = false]) {
late final isDark = theme.brightness == Brightness.dark;
Widget child() => Text.rich(
TextSpan(
children: [
if (videoDetailCtr.videoLabel.value.isNotEmpty) ...[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
decoration: BoxDecoration(
color: theme.colorScheme.secondaryContainer,
borderRadius: const BorderRadius.all(Radius.circular(4)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [
Icon(
Icons.shield_outlined,
size: 16,
color: theme.colorScheme.onSecondaryContainer,
),
Icon(
Icons.play_arrow_rounded,
size: 12,
color: theme.colorScheme.onSecondaryContainer,
),
],
),
Text(
videoDetailCtr.videoLabel.value,
textScaler: TextScaler.noScaling,
strutStyle: const StrutStyle(leading: 0, height: 1),
style: TextStyle(
height: 1,
fontSize: 13,
color: theme.colorScheme.onSecondaryContainer,
),
),
),
const TextSpan(text: ' '),
],
TextSpan(
text:
'${videoDetail.title ?? videoItem['title'] ?? ''}'),
],
],
),
),
),
maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
),
)
: Text(
'${videoDetail.title ?? videoItem['title'] ?? ''}',
maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
);
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(
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 {
if (!isProcessing) {

View File

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