opt req

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-15 09:52:25 +08:00
parent 1943b65788
commit 422b413778
51 changed files with 923 additions and 1143 deletions

View File

@@ -423,7 +423,7 @@ class PgcIntroController extends CommonIntroController {
SmartDialog.showToast('已三连');
return;
}
var result = await VideoHttp.triple(epId: epId, seasonId: seasonId);
var result = await VideoHttp.pgcTriple(epId: epId, seasonId: seasonId);
if (result['status']) {
PgcTriple data = result['data'];
late final stat = pgcItem.stat!;
@@ -431,7 +431,8 @@ class PgcIntroController extends CommonIntroController {
stat.like++;
hasLike.value = true;
}
if ((data.coin == 1) != hasCoin) {
final hasCoin = data.coin == 1;
if (this.hasCoin != hasCoin) {
stat.coin += 2;
coinNum.value = 2;
GlobalData().afterCoin(2);
@@ -440,7 +441,11 @@ class PgcIntroController extends CommonIntroController {
stat.favorite++;
hasFav.value = true;
}
SmartDialog.showToast('三连成功');
if (!hasCoin) {
SmartDialog.showToast('投币失败');
} else {
SmartDialog.showToast('三连成功');
}
} else {
SmartDialog.showToast(result['msg']);
}

View File

@@ -113,7 +113,7 @@ class _PgcIntroPageState extends TripleState<PgcIntroPage>
Widget? _buildBreif(PgcInfoModel item) {
final img = item.brief?.img;
if (img != null && img.isNotEmpty) {
final maxWidth = widget.maxWidth - 2 * StyleString.safeSpace;
final maxWidth = widget.maxWidth - 24;
double padding = max(0, maxWidth - 400);
final imgWidth = maxWidth - padding;
padding = padding / 2;

View File

@@ -193,7 +193,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
SmartDialog.showToast('已三连');
return;
}
var result = await VideoHttp.oneThree(bvid: bvid);
var result = await VideoHttp.ugcTriple(bvid: bvid);
if (result['status']) {
UgcTriple data = result['data'];
late final stat = videoDetail.value.stat!;
@@ -211,7 +211,11 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
hasFav.value = true;
}
hasDislike.value = false;
SmartDialog.showToast('三连成功');
if (data.coin != true) {
SmartDialog.showToast('投币失败');
} else {
SmartDialog.showToast('三连成功');
}
} else {
SmartDialog.showToast(result['msg']);
}

View File

@@ -1,4 +1,3 @@
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/badge.dart';
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
@@ -51,7 +50,6 @@ class MediaListPanel extends CommonCollapseSlidePage {
class _MediaListPanelState
extends CommonCollapseSlidePageState<MediaListPanel> {
late final int _index;
late final RxBool desc = widget.desc.obs;
@override
void initState() {
@@ -74,19 +72,14 @@ class _MediaListPanelState
title: Text(widget.panelTitle ?? '稍后再看'),
backgroundColor: Colors.transparent,
actions: [
Obx(
() {
final desc = this.desc.value;
return mediumButton(
tooltip: desc ? '顺序播放' : '倒序播放',
icon: desc
? MdiIcons.sortAscending
: MdiIcons.sortDescending,
onPressed: () {
widget.onReverse();
this.desc.value = !desc;
},
);
mediumButton(
tooltip: widget.desc ? '顺序播放' : '倒序播放',
icon: widget.desc
? MdiIcons.sortAscending
: MdiIcons.sortDescending,
onPressed: () {
Get.back();
widget.onReverse();
},
),
mediumButton(
@@ -131,169 +124,170 @@ class _MediaListPanelState
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
itemBuilder: ((context, index) {
var item = widget.mediaList[index];
if (index == widget.mediaList.length - 1 &&
(widget.count == null ||
widget.mediaList.length < widget.count!)) {
widget.loadMoreMedia();
}
var item = widget.mediaList[index];
final isCurr = item.bvid == widget.getBvId();
return SizedBox(
height: 98,
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () {
if (item.type != 2) {
SmartDialog.showToast('不支持播放该类型视频');
return;
}
Get.back();
widget.onChangeEpisode(item);
},
onLongPress: () => imageSaveDialog(
title: item.title,
cover: item.cover,
aid: item.aid,
bvid: item.bvid,
),
child: Stack(
clipBehavior: Clip.none,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 5,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
return Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: item.cover,
width: boxConstraints.maxWidth,
height: boxConstraints.maxHeight,
),
if (item.badge?.isNotEmpty == true)
PBadge(
text: item.badge,
right: 6.0,
top: 6.0,
type: switch (item.badge) {
'充电专属' => PBadgeType.error,
_ => PBadgeType.primary,
},
),
PBadge(
text: DurationUtil.formatDuration(
item.duration,
),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
),
],
);
},
),
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: isCurr ? FontWeight.bold : null,
color: isCurr
? theme.colorScheme.primary
: null,
),
),
if (item.type == 24 &&
item.intro?.isNotEmpty == true) ...[
const SizedBox(height: 3),
Text(
item.intro!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
],
const Spacer(),
Text(
item.upper!.name!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
),
),
if (item.type == 2) ...[
const SizedBox(height: 3),
Row(
spacing: 8,
children: [
StatWidget(
type: StatType.play,
value: item.cntInfo!.play,
),
StatWidget(
type: StatType.danmaku,
value: item.cntInfo!.danmaku,
),
],
),
],
],
),
),
],
),
),
if (showDelBtn && !isCurr)
Positioned(
right: 12,
bottom: -6,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => showConfirmDialog(
context: context,
title: '确定移除该视频?',
onConfirm: () => widget.onDelete!(item, index),
),
onLongPress: () => widget.onDelete!(item, index),
child: Padding(
padding: const EdgeInsets.all(9),
child: Icon(
Icons.clear,
size: 18,
color: theme.colorScheme.outline,
),
),
),
),
],
),
),
),
);
return _buildItem(theme, index, item, isCurr, showDelBtn);
}),
separatorBuilder: (context, index) => const SizedBox(height: 2),
);
},
);
Widget _buildItem(
ThemeData theme,
int index,
MediaListItemModel item,
bool isCurr,
bool showDelBtn,
) {
return SizedBox(
height: 98,
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () {
if (item.type != 2) {
SmartDialog.showToast('不支持播放该类型视频');
return;
}
Get.back();
widget.onChangeEpisode(item);
},
onLongPress: () => imageSaveDialog(
title: item.title,
cover: item.cover,
aid: item.aid,
bvid: item.bvid,
),
child: Stack(
clipBehavior: Clip.none,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 5,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: item.cover,
width: 140.8,
height: 88,
),
if (item.badge?.isNotEmpty == true)
PBadge(
text: item.badge,
right: 6.0,
top: 6.0,
type: switch (item.badge) {
'充电专属' => PBadgeType.error,
_ => PBadgeType.primary,
},
),
PBadge(
text: DurationUtil.formatDuration(
item.duration,
),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
),
],
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: isCurr ? FontWeight.bold : null,
color: isCurr ? theme.colorScheme.primary : null,
),
),
if (item.type == 24 &&
item.intro?.isNotEmpty == true) ...[
const SizedBox(height: 3),
Text(
item.intro!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
],
const Spacer(),
Text(
item.upper!.name!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
),
),
if (item.type == 2) ...[
const SizedBox(height: 3),
Row(
spacing: 8,
children: [
StatWidget(
type: StatType.play,
value: item.cntInfo!.play,
),
StatWidget(
type: StatType.danmaku,
value: item.cntInfo!.danmaku,
),
],
),
],
],
),
),
],
),
),
if (showDelBtn && !isCurr)
Positioned(
right: 12,
bottom: -6,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => showConfirmDialog(
context: context,
title: '确定移除该视频?',
onConfirm: () => widget.onDelete!(item, index),
),
onLongPress: () => widget.onDelete!(item, index),
child: Padding(
padding: const EdgeInsets.all(9),
child: Icon(
Icons.clear,
size: 18,
color: theme.colorScheme.outline,
),
),
),
),
],
),
),
),
);
}
}

View File

@@ -208,20 +208,16 @@ class _PayCoinsPageState extends State<PayCoinsPage>
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
bool isV = constraints.maxHeight > constraints.maxWidth;
return isV
? _buildBody(isV)
: Row(
children: [
const Spacer(),
Expanded(flex: 3, child: _buildBody(isV)),
const Spacer(),
],
);
},
);
bool isPortrait = context.isPortrait;
return isPortrait
? _buildBody(isPortrait)
: Row(
children: [
const Spacer(),
Expanded(flex: 3, child: _buildBody(isPortrait)),
const Spacer(),
],
);
}
Widget _buildBody(bool isV) => Stack(

View File

@@ -1,4 +1,3 @@
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/skeleton/video_card_h.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/video_card/video_card_h.dart';
@@ -31,7 +30,7 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
super.build(context);
return SliverPadding(
padding: const EdgeInsets.only(
top: StyleString.safeSpace - 5,
top: 7,
bottom: 80,
),
sliver: Obx(() => _buildBody(_relatedController.loadingState.value)),

View File

@@ -50,7 +50,7 @@ class _ViewPointsPageState
toolbarHeight: 45,
actions: [
const Text(
'分段进度条',
'分段进度条 ',
style: TextStyle(fontSize: 16),
),
Obx(
@@ -116,63 +116,71 @@ class _ViewPointsPageState
currentIndex = index;
}
}
return ListTile(
dense: true,
onTap: segment.from != null
? () {
currentIndex = index;
plPlayerController?.danmakuController?.clear();
plPlayerController?.videoPlayerController?.seek(
Duration(seconds: segment.from!),
);
Get.back();
}
: null,
leading: segment.url?.isNotEmpty == true
? Container(
margin: const EdgeInsets.symmetric(vertical: 6),
decoration: currentIndex == index
? BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(6),
),
border: Border.all(
width: 1.8,
strokeAlign: BorderSide.strokeAlignOutside,
color: theme.colorScheme.primary,
),
)
: null,
child: LayoutBuilder(
builder: (context, constraints) => NetworkImgLayer(
radius: 6,
src: segment.url,
width: constraints.maxHeight * StyleString.aspectRatio,
height: constraints.maxHeight,
),
),
)
: null,
title: Text(
segment.title ?? '',
style: TextStyle(
fontSize: 14,
fontWeight: currentIndex == index ? FontWeight.bold : null,
color: currentIndex == index ? theme.colorScheme.primary : null,
),
),
subtitle: Text(
'${segment.from != null ? DurationUtil.formatDuration(segment.from) : ''} - ${segment.to != null ? DurationUtil.formatDuration(segment.to) : ''}',
style: TextStyle(
fontSize: 13,
color: currentIndex == index
? theme.colorScheme.primary
: theme.colorScheme.outline,
),
),
);
final isCurr = currentIndex == index;
return _buildItem(theme, segment, isCurr);
},
separatorBuilder: (context, index) => divider,
);
}
Widget _buildItem(ThemeData theme, Segment segment, bool isCurr) {
final theme = Theme.of(context);
return Material(
type: MaterialType.transparency,
child: InkWell(
onTap: segment.from != null
? () {
Get.back();
plPlayerController
?..danmakuController?.clear()
..videoPlayerController?.seek(
Duration(seconds: segment.from!),
);
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
NetworkImgLayer(
src: segment.url,
width: 140.8,
height: 88,
),
const SizedBox(width: 10),
Expanded(
child: Column(
spacing: 10,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
segment.title ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: isCurr
? TextStyle(
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
)
: null,
),
Text(
'${segment.from != null ? DurationUtil.formatDuration(segment.from) : ''} - '
'${segment.to != null ? DurationUtil.formatDuration(segment.to) : ''}',
style: TextStyle(color: theme.colorScheme.outline),
),
],
),
),
],
),
),
),
);
}
}