opt: post segments

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-26 21:04:48 +08:00
parent 9f80683e78
commit d61147c106
2 changed files with 52 additions and 36 deletions

View File

@@ -61,20 +61,21 @@ class VideoCardHMemberVideo extends StatelessWidget {
Hero(
tag: heroTag,
child: NetworkImgLayer(
src:
videoItem.season?['cover'] ?? videoItem.cover,
src: videoItem.cover,
// videoItem.season?['cover'] ?? videoItem.cover,
width: maxWidth,
height: maxHeight,
),
),
if (videoItem.season != null)
PBadge(
text: '合集: ${videoItem.season?['count']}',
right: 6.0,
bottom: 6.0,
type: 'gray',
)
else if (videoItem.duration != null)
// if (videoItem.season != null)
// PBadge(
// text: '合集: ${videoItem.season?['count']}',
// right: 6.0,
// bottom: 6.0,
// type: 'gray',
// )
// else
if (videoItem.duration != null)
PBadge(
text: Utils.timeFormat(videoItem.duration),
right: 6.0,
@@ -126,7 +127,8 @@ class VideoContent extends StatelessWidget {
...[
Expanded(
child: Text(
videoItem.season?['title'] ?? videoItem.title ?? '',
// videoItem.season?['title'] ?? videoItem.title ?? '',
videoItem.title ?? '',
textAlign: TextAlign.start,
style: TextStyle(
fontWeight: FontWeight.w400,
@@ -157,13 +159,15 @@ class VideoContent extends StatelessWidget {
children: [
StatView(
theme: 'gray',
view: videoItem.season?['view_content'] ??
videoItem.viewContent,
// view: videoItem.season?['view_content'] ??
// videoItem.viewContent,
view: videoItem.viewContent,
),
const SizedBox(width: 8),
StatDanMu(
theme: 'gray',
danmu: videoItem.season?['danmaku'] ?? videoItem.danmaku,
// danmu: videoItem.season?['danmaku'] ?? videoItem.danmaku,
danmu: videoItem.danmaku,
),
],
),

View File

@@ -2,12 +2,14 @@ import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'package:PiliPalaX/common/constants.dart';
import 'package:PiliPalaX/common/widgets/article_content.dart';
import 'package:PiliPalaX/common/widgets/icon_button.dart';
import 'package:PiliPalaX/common/widgets/loading_widget.dart';
import 'package:PiliPalaX/common/widgets/pair.dart';
import 'package:PiliPalaX/common/widgets/segment_progress_bar.dart';
import 'package:PiliPalaX/http/danmaku.dart';
import 'package:PiliPalaX/http/init.dart';
import 'package:PiliPalaX/utils/extension.dart';
import 'package:dio/dio.dart';
import 'package:floating/floating.dart';
import 'package:flutter/material.dart';
@@ -1025,7 +1027,10 @@ class VideoDetailController extends GetxController
if (list!.isEmpty) {
list!.add(
PostSegmentModel(
segment: Pair(first: 0, second: 0),
segment: Pair(
first: plPlayerController.positionSeconds.value,
second: plPlayerController.positionSeconds.value,
),
category: SegmentType.sponsor,
actionType: ActionType.skip,
),
@@ -1178,7 +1183,10 @@ class VideoDetailController extends GetxController
list?.insert(
0,
PostSegmentModel(
segment: Pair(first: 0, second: 0),
segment: Pair(
first: plPlayerController.positionSeconds.value,
second: plPlayerController.positionSeconds.value,
),
category: SegmentType.sponsor,
actionType: ActionType.skip,
),
@@ -1222,11 +1230,8 @@ class VideoDetailController extends GetxController
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (list![index].category !=
SegmentType
.exclusive_access &&
list![index].actionType !=
ActionType.full) ...[
if (list![index].actionType !=
ActionType.full) ...[
Row(
children: [
...segmentWidget(
@@ -1254,28 +1259,35 @@ class VideoDetailController extends GetxController
list![index].category,
onSelected: (item) async {
list![index].category = item;
list![index].actionType =
List<ActionType>
constraintList =
_segmentType2ActionType(
item)
.first;
item);
if (constraintList
.contains(list![index]
.actionType)
.not) {
list![index].actionType =
constraintList.first;
}
switch (item) {
case SegmentType
.poi_highlight:
list![index]
.segment
.second =
list![index]
.segment
.first;
updateSegment(
isFirst: false,
index: index,
value: list![index]
.segment
.first,
);
break;
case SegmentType
.exclusive_access:
list![index]
.segment
.first = 0;
list![index]
.segment
.second = 0;
updateSegment(
isFirst: true,
index: index,
value: 0,
);
break;
case _:
}