Merge branch 'main' into feature-updateVideoDetailStructure

This commit is contained in:
guozhigq
2024-04-30 15:52:01 +08:00
42 changed files with 1084 additions and 766 deletions

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../models/common/video_episode_type.dart'; import '../models/common/video_episode_type.dart';
@ -44,7 +45,8 @@ class EpisodeBottomSheet {
title = '${episode.title}${episode.longTitle!}'; title = '${episode.title}${episode.longTitle!}';
break; break;
} }
return ListTile( return isFullScreen || episode?.cover == null || episode?.cover == ''
? ListTile(
onTap: () { onTap: () {
SmartDialog.showToast('切换至「$title'); SmartDialog.showToast('切换至「$title');
changeFucCall.call(episode, index); changeFucCall.call(episode, index);
@ -57,11 +59,35 @@ class EpisodeBottomSheet {
height: 12, height: 12,
) )
: null, : null,
title: Text( title: Text(title,
title,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: isCurrentIndex ? primary : onSurface, color: isCurrentIndex ? primary : onSurface,
)))
: InkWell(
onTap: () {
SmartDialog.showToast('切换至「$title');
changeFucCall.call(episode, index);
},
child: Padding(
padding:
const EdgeInsets.only(left: 14, right: 14, top: 8, bottom: 8),
child: Row(
children: [
NetworkImgLayer(
width: 130, height: 75, src: episode?.cover ?? ''),
const SizedBox(width: 10),
Expanded(
child: Text(
title,
maxLines: 2,
style: TextStyle(
fontSize: 14,
color: isCurrentIndex ? primary : onSurface,
),
),
),
],
), ),
), ),
); );

View File

@ -36,7 +36,6 @@ class NetworkImgLayer extends StatelessWidget {
final int defaultImgQuality = GlobalData().imgQuality; final int defaultImgQuality = GlobalData().imgQuality;
final String imageUrl = final String imageUrl =
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp'; '${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
// print(imageUrl);
int? memCacheWidth, memCacheHeight; int? memCacheWidth, memCacheHeight;
double aspectRatio = (width / height).toDouble(); double aspectRatio = (width / height).toDouble();

View File

@ -62,6 +62,7 @@ class OverlayPop extends StatelessWidget {
Expanded( Expanded(
child: Text( child: Text(
videoItem.title! as String, videoItem.title! as String,
style: Theme.of(context).textTheme.titleSmall,
), ),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),

View File

@ -23,6 +23,7 @@ class VideoCardH extends StatelessWidget {
this.showView = true, this.showView = true,
this.showDanmaku = true, this.showDanmaku = true,
this.showPubdate = false, this.showPubdate = false,
this.showCharge = false,
}); });
// ignore: prefer_typing_uninitialized_variables // ignore: prefer_typing_uninitialized_variables
final videoItem; final videoItem;
@ -33,6 +34,7 @@ class VideoCardH extends StatelessWidget {
final bool showView; final bool showView;
final bool showDanmaku; final bool showDanmaku;
final bool showPubdate; final bool showPubdate;
final bool showCharge;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -121,6 +123,13 @@ class VideoCardH extends StatelessWidget {
// videoItem.rcmdReason.content != '') // videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context, // pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null), // 6.0, 6.0, null, null),
if (showCharge && videoItem?.isChargingSrc)
const PBadge(
text: '充电专属',
right: 6.0,
top: 6.0,
type: 'primary',
),
], ],
); );
}, },

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pilipala/utils/feed_back.dart';
import '../../models/model_rec_video_item.dart'; import '../../models/model_rec_video_item.dart';
import 'overlay_pop.dart';
import 'stat/danmu.dart'; import 'stat/danmu.dart';
import 'stat/view.dart'; import 'stat/view.dart';
import '../../http/dynamics.dart'; import '../../http/dynamics.dart';
@ -19,15 +21,11 @@ import 'network_img_layer.dart';
class VideoCardV extends StatelessWidget { class VideoCardV extends StatelessWidget {
final dynamic videoItem; final dynamic videoItem;
final int crossAxisCount; final int crossAxisCount;
final Function()? longPress;
final Function()? longPressEnd;
const VideoCardV({ const VideoCardV({
Key? key, Key? key,
required this.videoItem, required this.videoItem,
required this.crossAxisCount, required this.crossAxisCount,
this.longPress,
this.longPressEnd,
}) : super(key: key); }) : super(key: key);
bool isStringNumeric(String str) { bool isStringNumeric(String str) {
@ -127,23 +125,17 @@ class VideoCardV extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(videoItem.id); String heroTag = Utils.makeHeroTag(videoItem.id);
return Card( return InkWell(
elevation: 0,
clipBehavior: Clip.hardEdge,
margin: EdgeInsets.zero,
child: GestureDetector(
onLongPress: () {
if (longPress != null) {
longPress!();
}
},
// onLongPressEnd: (details) {
// if (longPressEnd != null) {
// longPressEnd!();
// }
// },
child: InkWell(
onTap: () async => onPushDetail(heroTag), onTap: () async => onPushDetail(heroTag),
onLongPress: () {
SmartDialog.show(
builder: (context) => OverlayPop(
videoItem: videoItem,
closeFn: () => SmartDialog.dismiss(),
),
);
},
borderRadius: BorderRadius.circular(16),
child: Column( child: Column(
children: [ children: [
AspectRatio( AspectRatio(
@ -184,8 +176,6 @@ class VideoCardV extends StatelessWidget {
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount) VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
], ],
), ),
),
),
); );
} }
} }
@ -196,123 +186,91 @@ class VideoContent extends StatelessWidget {
const VideoContent( const VideoContent(
{Key? key, required this.videoItem, required this.crossAxisCount}) {Key? key, required this.videoItem, required this.crossAxisCount})
: super(key: key); : super(key: key);
Widget _buildBadge(String text, String type, [double fs = 12]) {
return PBadge(
text: text,
stack: 'normal',
size: 'small',
type: type,
fs: fs,
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Expanded( return Padding(
flex: crossAxisCount == 1 ? 0 : 1,
child: Padding(
padding: crossAxisCount == 1 padding: crossAxisCount == 1
? const EdgeInsets.fromLTRB(9, 9, 9, 4) ? const EdgeInsets.fromLTRB(9, 9, 9, 4)
: const EdgeInsets.fromLTRB(5, 8, 5, 4), : const EdgeInsets.fromLTRB(5, 8, 5, 4),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Text(
children: [
Expanded(
child: Text(
videoItem.title, videoItem.title,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
),
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
const SizedBox(width: 10),
VideoPopupMenu(
size: 32,
iconSize: 18,
videoItem: videoItem,
),
],
],
),
if (crossAxisCount > 1) ...[ if (crossAxisCount > 1) ...[
const SizedBox(height: 2), const SizedBox(height: 2),
VideoStat( VideoStat(videoItem: videoItem, crossAxisCount: crossAxisCount),
videoItem: videoItem,
crossAxisCount: crossAxisCount,
),
], ],
if (crossAxisCount == 1) const SizedBox(height: 4), if (crossAxisCount == 1) const SizedBox(height: 4),
Row( Row(
children: [ children: [
if (videoItem.goto == 'bangumi') ...[ if (videoItem.goto == 'bangumi')
PBadge( _buildBadge(videoItem.bangumiBadge, 'line', 9),
text: videoItem.bangumiBadge, if (videoItem.rcmdReason?.content != null &&
stack: 'normal', videoItem.rcmdReason.content != '')
size: 'small', _buildBadge(videoItem.rcmdReason.content, 'color'),
type: 'line', if (videoItem.goto == 'picture') _buildBadge('动态', 'line', 9),
fs: 9, if (videoItem.isFollowed == 1) _buildBadge('已关注', 'color'),
)
],
if (videoItem.rcmdReason != null &&
videoItem.rcmdReason.content != '') ...[
PBadge(
text: videoItem.rcmdReason.content,
stack: 'normal',
size: 'small',
type: 'color',
)
],
if (videoItem.goto == 'picture') ...[
const PBadge(
text: '动态',
stack: 'normal',
size: 'small',
type: 'line',
fs: 9,
)
],
if (videoItem.isFollowed == 1) ...[
const PBadge(
text: '已关注',
stack: 'normal',
size: 'small',
type: 'color',
)
],
Expanded( Expanded(
flex: crossAxisCount == 1 ? 0 : 1, flex: crossAxisCount == 1 ? 0 : 1,
child: Text( child: Text(
videoItem.owner.name, videoItem.owner.name,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),
), ),
), ),
if (crossAxisCount == 1) ...[ if (crossAxisCount == 1) ...[
Text( const SizedBox(width: 10),
'',
style: TextStyle(
fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline,
),
),
VideoStat( VideoStat(
videoItem: videoItem, videoItem: videoItem,
crossAxisCount: crossAxisCount, crossAxisCount: crossAxisCount,
), ),
const Spacer(), const Spacer(),
], ],
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[ if (videoItem.goto == 'av')
VideoPopupMenu( SizedBox(
size: 24, width: 24,
iconSize: 14, height: 24,
videoItem: videoItem, child: IconButton(
onPressed: () {
feedBack();
showModalBottomSheet(
context: context,
useRootNavigator: true,
isScrollControlled: true,
builder: (context) {
return MorePanel(videoItem: videoItem);
},
);
},
icon: Icon(
Icons.more_vert_outlined,
color: Theme.of(context).colorScheme.outline,
size: 14,
), ),
] else ...[ ),
const SizedBox(height: 24) )
]
], ],
), ),
], ],
), ),
),
); );
} }
} }
@ -331,15 +289,9 @@ class VideoStat extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
StatView( StatView(theme: 'gray', view: videoItem.stat.view),
theme: 'gray',
view: videoItem.stat.view,
),
const SizedBox(width: 8), const SizedBox(width: 8),
StatDanMu( StatDanMu(theme: 'gray', danmu: videoItem.stat.danmu),
theme: 'gray',
danmu: videoItem.stat.danmu,
),
if (videoItem is RecVideoItemModel) ...<Widget>[ if (videoItem is RecVideoItemModel) ...<Widget>[
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8), crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
RichText( RichText(
@ -358,69 +310,39 @@ class VideoStat extends StatelessWidget {
} }
} }
class VideoPopupMenu extends StatelessWidget { class MorePanel extends StatelessWidget {
final double? size;
final double? iconSize;
final dynamic videoItem; final dynamic videoItem;
const MorePanel({super.key, required this.videoItem});
const VideoPopupMenu({ Future<dynamic> menuActionHandler(String type) async {
Key? key, switch (type) {
required this.size, case 'block':
required this.iconSize, blockUser();
required this.videoItem, break;
}) : super(key: key); case 'watchLater':
var res = await UserHttp.toViewLater(bvid: videoItem.bvid as String);
@override
Widget build(BuildContext context) {
return SizedBox(
width: size,
height: size,
child: PopupMenuButton<String>(
padding: EdgeInsets.zero,
icon: Icon(
Icons.more_vert_outlined,
color: Theme.of(context).colorScheme.outline,
size: iconSize,
),
position: PopupMenuPosition.under,
// constraints: const BoxConstraints(maxHeight: 35),
onSelected: (String type) {},
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
PopupMenuItem<String>(
onTap: () async {
var res =
await UserHttp.toViewLater(bvid: videoItem.bvid as String);
SmartDialog.showToast(res['msg']); SmartDialog.showToast(res['msg']);
}, Get.back();
value: 'pause', break;
height: 40, default:
child: const Row( }
children: [ }
Icon(Icons.watch_later_outlined, size: 16),
SizedBox(width: 6), void blockUser() async {
Text('稍后再看', style: TextStyle(fontSize: 13))
],
),
),
const PopupMenuDivider(),
PopupMenuItem<String>(
onTap: () async {
SmartDialog.show( SmartDialog.show(
useSystem: true, useSystem: true,
animationType: SmartAnimationType.centerFade_otherSlide, animationType: SmartAnimationType.centerFade_otherSlide,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('提示'), title: const Text('提示'),
content: Text( content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
'\n\n被拉黑的Up可以在隐私设置-黑名单管理中解除'), '\n\n被拉黑的Up可以在隐私设置-黑名单管理中解除'),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => SmartDialog.dismiss(), onPressed: () => SmartDialog.dismiss(),
child: Text( child: Text(
'点错了', '点错了',
style: TextStyle( style: TextStyle(color: Theme.of(context).colorScheme.outline),
color: Theme.of(context).colorScheme.outline),
), ),
), ),
TextButton( TextButton(
@ -439,18 +361,47 @@ class VideoPopupMenu extends StatelessWidget {
); );
}, },
); );
}, }
value: 'pause',
height: 40, @override
child: Row( Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.block, size: 16), InkWell(
const SizedBox(width: 6), onTap: () => Get.back(),
Text('拉黑:${videoItem.owner.name}', child: Container(
style: const TextStyle(fontSize: 13)) height: 35,
], padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))),
), ),
), ),
),
),
ListTile(
onTap: () async => await menuActionHandler('block'),
minLeadingWidth: 0,
leading: const Icon(Icons.block, size: 19),
title: Text(
'拉黑up主 「${videoItem.owner.name}',
style: Theme.of(context).textTheme.titleSmall,
),
),
ListTile(
onTap: () async => await menuActionHandler('watchLater'),
minLeadingWidth: 0,
leading: const Icon(Icons.watch_later_outlined, size: 19),
title:
Text('添加至稍后再看', style: Theme.of(context).textTheme.titleSmall),
),
], ],
), ),
); );

View File

@ -22,19 +22,14 @@ class ReplyHttp {
return { return {
'status': true, 'status': true,
'data': ReplyData.fromJson(res.data['data']), 'data': ReplyData.fromJson(res.data['data']),
'code': 200,
}; };
} else { } else {
Map errMap = {
-400: '请求错误',
-404: '无此项',
12002: '当前页面评论功能已关闭',
12009: '评论主体的type不合法',
12061: 'UP主已关闭评论区',
};
return { return {
'status': false, 'status': false,
'date': [], 'date': [],
'msg': errMap[res.data['code']] ?? res.data['message'], 'code': res.data['code'],
'msg': res.data['message'],
}; };
} }
} }

View File

@ -35,7 +35,7 @@ class VideoHttp {
Api.recommendListWeb, Api.recommendListWeb,
data: { data: {
'version': 1, 'version': 1,
'feed_version': 'V8', 'feed_version': 'V3',
'homepage_ver': 1, 'homepage_ver': 1,
'ps': ps, 'ps': ps,
'fresh_idx': freshIdx, 'fresh_idx': freshIdx,
@ -192,22 +192,15 @@ class VideoHttp {
// 视频信息 标题、简介 // 视频信息 标题、简介
static Future videoIntro({required String bvid}) async { static Future videoIntro({required String bvid}) async {
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid}); var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
if (res.data['code'] == 0) {
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data); VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
if (result.code == 0) {
return {'status': true, 'data': result.data!}; return {'status': true, 'data': result.data!};
} else { } else {
Map errMap = {
-400: '请求错误',
-403: '权限不足',
-404: '视频资源失效',
62002: '稿件不可见',
62004: '稿件审核中',
};
return { return {
'status': false, 'status': false,
'data': null, 'data': null,
'code': result.code, 'code': res.data['code'],
'msg': errMap[result.code] ?? '请求异常', 'msg': res.data['message'],
}; };
} }
} }

View File

@ -65,6 +65,20 @@ void main() async {
}, },
); );
// 小白条、导航栏沉浸
if (Platform.isAndroid) {
List<String> versionParts = Platform.version.split('.');
int androidVersion = int.parse(versionParts[0]);
if (androidVersion >= 29) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
}
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
systemNavigationBarDividerColor: Colors.transparent,
statusBarColor: Colors.transparent,
));
}
Data.init(); Data.init();
GlobalData(); GlobalData();
PiliSchame.init(); PiliSchame.init();
@ -130,26 +144,33 @@ class MyApp extends StatelessWidget {
); );
} }
ThemeData themeData = ThemeData( // ThemeData themeData = ThemeData(
colorScheme: currentThemeValue == ThemeType.dark // colorScheme: currentThemeValue == ThemeType.dark
? darkColorScheme // ? darkColorScheme
: lightColorScheme, // : lightColorScheme,
); // );
// 小白条、导航栏沉浸 // // 小白条、导航栏沉浸
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); // if (Platform.isAndroid) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( // List<String> versionParts = Platform.version.split('.');
systemNavigationBarColor: GlobalData().enableMYBar // int androidVersion = int.parse(versionParts[0]);
? const Color(0x00010000) // if (androidVersion >= 29) {
: themeData.canvasColor, // SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
systemNavigationBarDividerColor: GlobalData().enableMYBar // }
? const Color(0x00010000) // SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
: themeData.canvasColor, // systemNavigationBarColor: GlobalData().enableMYBar
systemNavigationBarIconBrightness: currentThemeValue == ThemeType.dark // ? const Color(0x00010000)
? Brightness.light // : themeData.canvasColor,
: Brightness.dark, // systemNavigationBarDividerColor: GlobalData().enableMYBar
statusBarColor: Colors.transparent, // ? const Color(0x00010000)
)); // : themeData.canvasColor,
// systemNavigationBarIconBrightness:
// currentThemeValue == ThemeType.dark
// ? Brightness.light
// : Brightness.dark,
// statusBarColor: Colors.transparent,
// ));
// }
// 图片缓存 // 图片缓存
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20; // PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;

View File

@ -414,6 +414,7 @@ class DynamicMajorModel {
this.none, this.none,
this.type, this.type,
this.courses, this.courses,
this.common,
}); });
DynamicArchiveModel? archive; DynamicArchiveModel? archive;
@ -429,6 +430,7 @@ class DynamicMajorModel {
// MAJOR_TYPE_OPUS 图文/文章 // MAJOR_TYPE_OPUS 图文/文章
String? type; String? type;
Map? courses; Map? courses;
Map? common;
DynamicMajorModel.fromJson(Map<String, dynamic> json) { DynamicMajorModel.fromJson(Map<String, dynamic> json) {
archive = json['archive'] != null archive = json['archive'] != null
@ -452,6 +454,7 @@ class DynamicMajorModel {
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null; json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
type = json['type']; type = json['type'];
courses = json['courses'] ?? {}; courses = json['courses'] ?? {};
common = json['common'] ?? {};
} }
} }

View File

@ -23,6 +23,7 @@ class HotVideoItemModel {
this.dimension, this.dimension,
this.shortLinkV2, this.shortLinkV2,
this.firstFrame, this.firstFrame,
this.cover,
this.pubLocation, this.pubLocation,
this.seasontype, this.seasontype,
this.isOgv, this.isOgv,
@ -50,6 +51,7 @@ class HotVideoItemModel {
Dimension? dimension; Dimension? dimension;
String? shortLinkV2; String? shortLinkV2;
String? firstFrame; String? firstFrame;
String? cover;
String? pubLocation; String? pubLocation;
int? seasontype; int? seasontype;
bool? isOgv; bool? isOgv;
@ -77,6 +79,7 @@ class HotVideoItemModel {
dimension = Dimension.fromMap(json['dimension']); dimension = Dimension.fromMap(json['dimension']);
shortLinkV2 = json["short_link_v2"]; shortLinkV2 = json["short_link_v2"];
firstFrame = json["first_frame"]; firstFrame = json["first_frame"];
cover = json["first_frame"];
pubLocation = json["pub_location"]; pubLocation = json["pub_location"];
seasontype = json["seasontype"]; seasontype = json["seasontype"];
isOgv = json["isOgv"]; isOgv = json["isOgv"];

View File

@ -39,6 +39,14 @@ extension VideoQualityCode on VideoQuality {
} }
return null; return null;
} }
static int? toCode(VideoQuality quality) {
final index = VideoQuality.values.indexOf(quality);
if (index != -1 && index < _codeList.length) {
return _codeList[index];
}
return null;
}
} }
extension VideoQualityDesc on VideoQuality { extension VideoQualityDesc on VideoQuality {

View File

@ -67,6 +67,7 @@ class VideoDetailData {
String? likeIcon; String? likeIcon;
bool? needJumpBv; bool? needJumpBv;
String? epId; String? epId;
List<Staff>? staff;
VideoDetailData({ VideoDetailData({
this.bvid, this.bvid,
@ -103,6 +104,7 @@ class VideoDetailData {
this.likeIcon, this.likeIcon,
this.needJumpBv, this.needJumpBv,
this.epId, this.epId,
this.staff,
}); });
VideoDetailData.fromJson(Map<String, dynamic> json) { VideoDetailData.fromJson(Map<String, dynamic> json) {
@ -155,6 +157,9 @@ class VideoDetailData {
if (json['redirect_url'] != null) { if (json['redirect_url'] != null) {
epId = resolveEpId(json['redirect_url']); epId = resolveEpId(json['redirect_url']);
} }
staff = json["staff"] != null
? List<Staff>.from(json["staff"]!.map((e) => Staff.fromJson(e)))
: null;
} }
String resolveEpId(url) { String resolveEpId(url) {
@ -377,6 +382,7 @@ class Part {
String? weblink; String? weblink;
Dimension? dimension; Dimension? dimension;
String? firstFrame; String? firstFrame;
String? cover;
Part({ Part({
this.cid, this.cid,
@ -388,6 +394,7 @@ class Part {
this.weblink, this.weblink,
this.dimension, this.dimension,
this.firstFrame, this.firstFrame,
this.cover,
}); });
fromRawJson(String str) => Part.fromJson(json.decode(str)); fromRawJson(String str) => Part.fromJson(json.decode(str));
@ -405,7 +412,8 @@ class Part {
dimension = json["dimension"] == null dimension = json["dimension"] == null
? null ? null
: Dimension.fromJson(json["dimension"]); : Dimension.fromJson(json["dimension"]);
firstFrame = json["first_frame"]; firstFrame = json["first_frame"] ?? '';
cover = json["first_frame"] ?? '';
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -629,6 +637,7 @@ class EpisodeItem {
this.attribute, this.attribute,
this.page, this.page,
this.bvid, this.bvid,
this.cover,
}); });
int? seasonId; int? seasonId;
int? sectionId; int? sectionId;
@ -639,6 +648,7 @@ class EpisodeItem {
int? attribute; int? attribute;
Part? page; Part? page;
String? bvid; String? bvid;
String? cover;
EpisodeItem.fromJson(Map<String, dynamic> json) { EpisodeItem.fromJson(Map<String, dynamic> json) {
seasonId = json['season_id']; seasonId = json['season_id'];
@ -650,5 +660,46 @@ class EpisodeItem {
attribute = json['attribute']; attribute = json['attribute'];
page = Part.fromJson(json['page']); page = Part.fromJson(json['page']);
bvid = json['bvid']; bvid = json['bvid'];
cover = json['arc']['pic'];
}
}
class Staff {
Staff({
this.mid,
this.title,
this.name,
this.face,
this.vip,
});
int? mid;
String? title;
String? name;
String? face;
int? status;
Vip? vip;
Staff.fromJson(Map<String, dynamic> json) {
mid = json['mid'];
title = json['title'];
name = json['name'];
face = json['face'];
vip = Vip.fromJson(json['vip']);
}
}
class Vip {
Vip({
this.type,
this.status,
});
int? type;
int? status;
Vip.fromJson(Map<String, dynamic> json) {
type = json['type'];
status = json['status'];
} }
} }

View File

@ -131,51 +131,37 @@ class BangumiIntroController extends GetxController {
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
title: const Text('选择投币个数'), title: const Text('选择投币个数'),
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12), contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
content: StatefulBuilder(builder: (context, StateSetter setState) { content: StatefulBuilder(builder: (context, StateSetter setState) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [1, 2]
RadioListTile( .map(
value: 1, (e) => RadioListTile(
title: const Text('1枚'), value: e,
title: Text('$e枚'),
groupValue: _tempThemeValue, groupValue: _tempThemeValue,
onChanged: (value) { onChanged: (value) async {
_tempThemeValue = value!; _tempThemeValue = value!;
Get.appUpdate(); setState(() {});
},
),
RadioListTile(
value: 2,
title: const Text('2枚'),
groupValue: _tempThemeValue,
onChanged: (value) {
_tempThemeValue = value!;
Get.appUpdate();
},
),
],
);
}),
actions: [
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
TextButton(
onPressed: () async {
var res = await VideoHttp.coinVideo( var res = await VideoHttp.coinVideo(
bvid: bvid, multiply: _tempThemeValue); bvid: bvid, multiply: _tempThemeValue);
if (res['status']) { if (res['status']) {
SmartDialog.showToast('投币成功 👏'); SmartDialog.showToast('投币成功 👏');
hasCoin.value = true; hasCoin.value = true;
bangumiDetail.value.stat!['coins'] = bangumiDetail.value.stat!['coins'] =
bangumiDetail.value.stat!['coins'] + _tempThemeValue; bangumiDetail.value.stat!['coins'] +
_tempThemeValue;
} else { } else {
SmartDialog.showToast(res['msg']); SmartDialog.showToast(res['msg']);
} }
Get.back(); Get.back();
}, },
child: const Text('确定'), ),
) )
], .toList(),
);
}),
); );
}); });
} }
@ -229,13 +215,15 @@ class BangumiIntroController extends GetxController {
} }
// 修改分P或番剧分集 // 修改分P或番剧分集
Future changeSeasonOrbangu(bvid, cid, aid) async { Future changeSeasonOrbangu(bvid, cid, aid, cover) async {
// 重新获取视频资源 // 重新获取视频资源
VideoDetailController videoDetailCtr = VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']); Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
videoDetailCtr.bvid = bvid; videoDetailCtr.bvid = bvid;
videoDetailCtr.cid.value = cid; videoDetailCtr.cid.value = cid;
videoDetailCtr.danmakuCid.value = cid; videoDetailCtr.danmakuCid.value = cid;
videoDetailCtr.oid.value = aid;
videoDetailCtr.cover.value = cover;
videoDetailCtr.queryVideoUrl(); videoDetailCtr.queryVideoUrl();
// 重新请求评论 // 重新请求评论
try { try {
@ -294,7 +282,8 @@ class BangumiIntroController extends GetxController {
int cid = episodes[nextIndex].cid!; int cid = episodes[nextIndex].cid!;
String bvid = episodes[nextIndex].bvid!; String bvid = episodes[nextIndex].bvid!;
int aid = episodes[nextIndex].aid!; int aid = episodes[nextIndex].aid!;
changeSeasonOrbangu(bvid, cid, aid); String cover = episodes[nextIndex].cover!;
changeSeasonOrbangu(bvid, cid, aid, cover);
} }
// 播放器底栏 选集 回调 // 播放器底栏 选集 回调
@ -315,7 +304,7 @@ class BangumiIntroController extends GetxController {
sheetHeight: Get.size.height, sheetHeight: Get.size.height,
isFullScreen: true, isFullScreen: true,
changeFucCall: (item, index) { changeFucCall: (item, index) {
changeSeasonOrbangu(item.bvid, item.cid, item.aid); changeSeasonOrbangu(item.bvid, item.cid, item.aid, item.cover);
SmartDialog.dismiss(); SmartDialog.dismiss();
}, },
).buildShowContent(Get.context!), ).buildShowContent(Get.context!),

View File

@ -322,8 +322,8 @@ class _BangumiInfoState extends State<BangumiInfo> {
pages: widget.bangumiDetail!.episodes!, pages: widget.bangumiDetail!.episodes!,
cid: cid! ?? widget.bangumiDetail!.episodes!.first.cid!, cid: cid! ?? widget.bangumiDetail!.episodes!.first.cid!,
sheetHeight: sheetHeight, sheetHeight: sheetHeight,
changeFuc: (bvid, cid, aid) => changeFuc: (bvid, cid, aid, cover) => bangumiIntroController
bangumiIntroController.changeSeasonOrbangu(bvid, cid, aid), .changeSeasonOrbangu(bvid, cid, aid, cover),
bangumiDetail: bangumiIntroController.bangumiDetail.value, bangumiDetail: bangumiIntroController.bangumiDetail.value,
bangumiIntroController: bangumiIntroController, bangumiIntroController: bangumiIntroController,
) )

View File

@ -84,9 +84,12 @@ class _BangumiPanelState extends State<BangumiPanel> {
item.bvid, item.bvid,
item.cid, item.cid,
item.aid, item.aid,
item.cover,
); );
if (_bottomSheetController != null) {
_bottomSheetController?.close(); _bottomSheetController?.close();
currentIndex = i; }
currentIndex.value = i;
scrollToIndex(); scrollToIndex();
} }

View File

@ -25,6 +25,7 @@ class DynamicDetailController extends GetxController {
RxString sortTypeTitle = ReplySortType.time.titles.obs; RxString sortTypeTitle = ReplySortType.time.titles.obs;
RxString sortTypeLabel = ReplySortType.time.labels.obs; RxString sortTypeLabel = ReplySortType.time.labels.obs;
Box setting = GStrorage.setting; Box setting = GStrorage.setting;
RxInt replyReqCode = 200.obs;
@override @override
void onInit() { void onInit() {
@ -84,6 +85,7 @@ class DynamicDetailController extends GetxController {
replyList.addAll(replies); replyList.addAll(replies);
} }
} }
replyReqCode.value = res['code'];
isLoadingMore = false; isLoadingMore = false;
return res; return res;
} }

View File

@ -369,7 +369,10 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
curve: Curves.easeInOut, curve: Curves.easeInOut,
), ),
), ),
child: FloatingActionButton( child: Obx(
() => _dynamicDetailController.replyReqCode.value == 12061
? const SizedBox()
: FloatingActionButton(
heroTag: null, heroTag: null,
onPressed: () { onPressed: () {
feedBack(); feedBack();
@ -390,7 +393,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
// 完成评论,数据添加 // 完成评论,数据添加
if (value != null && value['data'] != null) if (value != null && value['data'] != null)
{ {
_dynamicDetailController.replyList.add(value['data']), _dynamicDetailController.replyList
.add(value['data']),
_dynamicDetailController.acount.value++ _dynamicDetailController.acount.value++
} }
}, },
@ -400,6 +404,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
child: const Icon(Icons.reply), child: const Icon(Icons.reply),
), ),
), ),
),
); );
} }
} }

View File

@ -2,6 +2,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
import 'additional_panel.dart'; import 'additional_panel.dart';
@ -182,6 +183,61 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
) )
], ],
); );
// 活动
case 'DYNAMIC_TYPE_COMMON_SQUARE':
return Padding(
padding: const EdgeInsets.only(top: 8),
child: InkWell(
onTap: () {
Get.toNamed('/webview', parameters: {
'url': item.modules.moduleDynamic.major.common['jump_url'],
'type': 'url',
'pageTitle': item.modules.moduleDynamic.major.common['title']
});
},
child: Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10),
color: Theme.of(context).dividerColor.withOpacity(0.08),
child: Row(
children: [
NetworkImgLayer(
width: 45,
height: 45,
src: item.modules.moduleDynamic.major.common['cover'],
),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.modules.moduleDynamic.major.common['title'],
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 2),
Text(
item.modules.moduleDynamic.major.common['desc'],
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
)
],
),
// TextButton(onPressed: () {}, child: Text('123'))
),
),
);
default: default:
return const SizedBox( return const SizedBox(
width: double.infinity, width: double.infinity,

View File

@ -214,24 +214,8 @@ class UserInfoWidget extends StatelessWidget {
final VoidCallback? callback; final VoidCallback? callback;
final HomeController? ctr; final HomeController? ctr;
@override Widget buildLoggedInWidget(context) {
Widget build(BuildContext context) { return Stack(
return Row(
children: [
SearchBar(ctr: ctr),
if (userLogin.value) ...[
const SizedBox(width: 4),
ClipRect(
child: IconButton(
onPressed: () => Get.toNamed('/whisper'),
icon: const Icon(Icons.notifications_none),
),
)
],
const SizedBox(width: 8),
Obx(
() => userLogin.value
? Stack(
children: [ children: [
NetworkImgLayer( NetworkImgLayer(
type: 'avatar', type: 'avatar',
@ -255,7 +239,27 @@ class UserInfoWidget extends StatelessWidget {
), ),
) )
], ],
);
}
@override
Widget build(BuildContext context) {
return Row(
children: [
SearchBar(ctr: ctr),
if (userLogin.value) ...[
const SizedBox(width: 4),
ClipRect(
child: IconButton(
onPressed: () => Get.toNamed('/whisper'),
icon: const Icon(Icons.notifications_none),
),
) )
],
const SizedBox(width: 8),
Obx(
() => userLogin.value
? buildLoggedInWidget(context)
: DefaultUser(callback: () => callback!()), : DefaultUser(callback: () => callback!()),
), ),
], ],
@ -402,34 +406,31 @@ class SearchBar extends StatelessWidget {
color: colorScheme.onSecondaryContainer.withOpacity(0.05), color: colorScheme.onSecondaryContainer.withOpacity(0.05),
child: InkWell( child: InkWell(
splashColor: colorScheme.primaryContainer.withOpacity(0.3), splashColor: colorScheme.primaryContainer.withOpacity(0.3),
onTap: () => Get.toNamed( onTap: () => Get.toNamed('/search',
'/search', parameters: {'hintText': ctr!.defaultSearch.value}),
parameters: {'hintText': ctr!.defaultSearch.value}, child: Padding(
), padding: const EdgeInsets.symmetric(horizontal: 14),
child: Row( child: Row(
children: [ children: [
const SizedBox(width: 14),
Icon( Icon(
Icons.search_outlined, Icons.search_outlined,
color: colorScheme.onSecondaryContainer, color: colorScheme.onSecondaryContainer,
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Obx( Obx(
() => Expanded( () => Text(
child: Text(
ctr!.defaultSearch.value, ctr!.defaultSearch.value,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(color: colorScheme.outline), style: TextStyle(color: colorScheme.outline),
), ),
), ),
),
const SizedBox(width: 15),
], ],
), ),
), ),
), ),
), ),
),
); );
} }
} }

View File

@ -79,6 +79,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
videoItem: list[index], videoItem: list[index],
showOwner: false, showOwner: false,
showPubdate: true, showPubdate: true,
showCharge: true,
); );
}, },
childCount: list.length, childCount: list.length,

View File

@ -5,9 +5,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pilipala/common/constants.dart'; import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/skeleton/video_card_v.dart'; import 'package:pilipala/common/skeleton/video_card_v.dart';
import 'package:pilipala/common/widgets/animated_dialog.dart';
import 'package:pilipala/common/widgets/http_error.dart'; import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/common/widgets/overlay_pop.dart';
import 'package:pilipala/common/widgets/video_card_v.dart'; import 'package:pilipala/common/widgets/video_card_v.dart';
import 'package:pilipala/utils/main_stream.dart'; import 'package:pilipala/utils/main_stream.dart';
@ -118,16 +116,6 @@ class _RcmdPageState extends State<RcmdPage>
); );
} }
OverlayEntry _createPopupDialog(videoItem) {
return OverlayEntry(
builder: (context) => AnimatedDialog(
closeFn: _rcmdController.popupDialog?.remove,
child: OverlayPop(
videoItem: videoItem, closeFn: _rcmdController.popupDialog?.remove),
),
);
}
Widget contentGrid(ctr, videoList) { Widget contentGrid(ctr, videoList) {
// double maxWidth = Get.size.width; // double maxWidth = Get.size.width;
// int baseWidth = 500; // int baseWidth = 500;
@ -158,14 +146,6 @@ class _RcmdPageState extends State<RcmdPage>
? VideoCardV( ? VideoCardV(
videoItem: videoList[index], videoItem: videoList[index],
crossAxisCount: crossAxisCount, crossAxisCount: crossAxisCount,
longPress: () {
_rcmdController.popupDialog =
_createPopupDialog(videoList[index]);
Overlay.of(context).insert(_rcmdController.popupDialog!);
},
longPressEnd: () {
_rcmdController.popupDialog?.remove();
},
) )
: const VideoCardVSkeleton(); : const VideoCardVSkeleton();
}, },

View File

@ -131,7 +131,7 @@ class _PlaySettingState extends State<PlaySetting> {
title: '开启硬解', title: '开启硬解',
subTitle: '以较低功耗播放视频', subTitle: '以较低功耗播放视频',
setKey: SettingBoxKey.enableHA, setKey: SettingBoxKey.enableHA,
defaultVal: true, defaultVal: false,
), ),
const SetSwitchItem( const SetSwitchItem(
title: '观看人数', title: '观看人数',

View File

@ -29,7 +29,7 @@ class _SelectDialogState<T> extends State<SelectDialog<T>> {
return AlertDialog( return AlertDialog(
title: Text(widget.title), title: Text(widget.title),
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12), contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
content: StatefulBuilder(builder: (context, StateSetter setState) { content: StatefulBuilder(builder: (context, StateSetter setState) {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(

View File

@ -51,7 +51,7 @@ class VideoDetailController extends GetxController
/// 播放器配置 画质 音质 解码格式 /// 播放器配置 画质 音质 解码格式
late VideoQuality currentVideoQa; late VideoQuality currentVideoQa;
AudioQuality? currentAudioQa; AudioQuality? currentAudioQa;
late VideoDecodeFormats currentDecodeFormats; VideoDecodeFormats? currentDecodeFormats;
// 是否开始自动播放 存在多p的情况下第二p需要为true // 是否开始自动播放 存在多p的情况下第二p需要为true
RxBool autoPlay = true.obs; RxBool autoPlay = true.obs;
// 视频资源是否有效 // 视频资源是否有效
@ -59,7 +59,7 @@ class VideoDetailController extends GetxController
// 封面图的展示 // 封面图的展示
RxBool isShowCover = true.obs; RxBool isShowCover = true.obs;
// 硬解 // 硬解
RxBool enableHA = true.obs; RxBool enableHA = false.obs;
/// 本地存储 /// 本地存储
Box userInfoCache = GStrorage.userInfo; Box userInfoCache = GStrorage.userInfo;
@ -73,6 +73,7 @@ class VideoDetailController extends GetxController
ReplyItemModel? firstFloor; ReplyItemModel? firstFloor;
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
RxString bgCover = ''.obs; RxString bgCover = ''.obs;
RxString cover = ''.obs;
PlPlayerController plPlayerController = PlPlayerController.getInstance(); PlPlayerController plPlayerController = PlPlayerController.getInstance();
late VideoItem firstVideo; late VideoItem firstVideo;
@ -107,28 +108,26 @@ class VideoDetailController extends GetxController
BottomControlType.fullscreen, BottomControlType.fullscreen,
].obs; ].obs;
RxDouble sheetHeight = 0.0.obs; RxDouble sheetHeight = 0.0.obs;
RxString archiveSourceType = 'dash'.obs;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
final Map argMap = Get.arguments; final Map argMap = Get.arguments;
userInfo = userInfoCache.get('userInfoCache'); userInfo = userInfoCache.get('userInfoCache');
var keys = argMap.keys.toList(); if (argMap.containsKey('videoItem')) {
if (keys.isNotEmpty) {
if (keys.contains('videoItem')) {
var args = argMap['videoItem']; var args = argMap['videoItem'];
if (args.pic != null && args.pic != '') { updateCover(args.pic);
videoItem['pic'] = args.pic;
}
}
if (keys.contains('pic')) {
videoItem['pic'] = argMap['pic'];
} }
if (argMap.containsKey('pic')) {
updateCover(argMap['pic']);
} }
tabCtr = TabController(length: 2, vsync: this); tabCtr = TabController(length: 2, vsync: this);
autoPlay.value = autoPlay.value =
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true); enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: false);
enableRelatedVideo = enableRelatedVideo =
setting.get(SettingBoxKey.enableRelatedVideo, defaultValue: true); setting.get(SettingBoxKey.enableRelatedVideo, defaultValue: true);
if (userInfo == null || if (userInfo == null ||
@ -161,11 +160,11 @@ class VideoDetailController extends GetxController
getSubtitle(); getSubtitle();
} }
showReplyReplyPanel() { showReplyReplyPanel(oid, fRpid, firstFloor) {
replyReplyBottomSheetCtr = replyReplyBottomSheetCtr =
scaffoldKey.currentState?.showBottomSheet((BuildContext context) { scaffoldKey.currentState?.showBottomSheet((BuildContext context) {
return VideoReplyReplyPanel( return VideoReplyReplyPanel(
oid: oid.value, oid: oid,
rpid: fRpid, rpid: fRpid,
closePanel: () => { closePanel: () => {
fRpid = 0, fRpid = 0,
@ -189,12 +188,13 @@ class VideoDetailController extends GetxController
plPlayerController.isBuffering.value = false; plPlayerController.isBuffering.value = false;
plPlayerController.buffered.value = Duration.zero; plPlayerController.buffered.value = Duration.zero;
if (archiveSourceType.value == 'dash') {
/// 根据currentVideoQa和currentDecodeFormats 重新设置videoUrl /// 根据currentVideoQa和currentDecodeFormats 重新设置videoUrl
List<VideoItem> videoList = List<VideoItem> videoList =
data.dash!.video!.where((i) => i.id == currentVideoQa.code).toList(); data.dash!.video!.where((i) => i.id == currentVideoQa.code).toList();
try { try {
firstVideo = videoList firstVideo = videoList.firstWhere(
.firstWhere((i) => i.codecs!.startsWith(currentDecodeFormats.code)); (i) => i.codecs!.startsWith(currentDecodeFormats?.code));
} catch (_) { } catch (_) {
if (currentVideoQa == VideoQuality.dolbyVision) { if (currentVideoQa == VideoQuality.dolbyVision) {
firstVideo = videoList.first; firstVideo = videoList.first;
@ -205,8 +205,8 @@ class VideoDetailController extends GetxController
currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get( currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get(
SettingBoxKey.defaultDecode, SettingBoxKey.defaultDecode,
defaultValue: VideoDecodeFormats.values.last.code))!; defaultValue: VideoDecodeFormats.values.last.code))!;
firstVideo = videoList firstVideo = videoList.firstWhere(
.firstWhere((i) => i.codecs!.startsWith(currentDecodeFormats.code)); (i) => i.codecs!.startsWith(currentDecodeFormats?.code));
} }
} }
videoUrl = firstVideo.baseUrl!; videoUrl = firstVideo.baseUrl!;
@ -219,7 +219,12 @@ class VideoDetailController extends GetxController
); );
audioUrl = firstAudio.baseUrl ?? ''; audioUrl = firstAudio.baseUrl ?? '';
} }
}
if (archiveSourceType.value == 'durl') {
cacheVideoQa = VideoQualityCode.toCode(currentVideoQa);
queryVideoUrl();
}
playerInit(); playerInit();
} }
@ -272,7 +277,8 @@ class VideoDetailController extends GetxController
// 视频链接 // 视频链接
Future queryVideoUrl() async { Future queryVideoUrl() async {
var result = await VideoHttp.videoUrl(cid: cid.value, bvid: bvid); var result =
await VideoHttp.videoUrl(cid: cid.value, bvid: bvid, qn: cacheVideoQa);
if (result['status']) { if (result['status']) {
data = result['data']; data = result['data'];
if (data.acceptDesc!.isNotEmpty && data.acceptDesc!.contains('试看')) { if (data.acceptDesc!.isNotEmpty && data.acceptDesc!.contains('试看')) {
@ -290,8 +296,22 @@ class VideoDetailController extends GetxController
} }
return result; return result;
} }
if (data.durl != null) {
archiveSourceType.value = 'durl';
videoUrl = data.durl!.first.url!;
audioUrl = '';
defaultST = Duration.zero;
firstVideo = VideoItem();
currentVideoQa = VideoQualityCode.fromCode(data.quality!)!;
if (autoPlay.value) {
await playerInit();
isShowCover.value = false;
}
return result;
}
final List<VideoItem> allVideosList = data.dash!.video!; final List<VideoItem> allVideosList = data.dash!.video!;
try { try {
archiveSourceType.value = 'dash';
// 当前可播放的最高质量视频 // 当前可播放的最高质量视频
int currentHighVideoQa = allVideosList.first.quality!.code; int currentHighVideoQa = allVideosList.first.quality!.code;
// 预设的画质为null则当前可用的最高质量 // 预设的画质为null则当前可用的最高质量
@ -321,7 +341,7 @@ class VideoDetailController extends GetxController
// 当前视频没有对应格式返回第一个 // 当前视频没有对应格式返回第一个
bool flag = false; bool flag = false;
for (var i in supportDecodeFormats) { for (var i in supportDecodeFormats) {
if (i.startsWith(currentDecodeFormats.code)) { if (i.startsWith(currentDecodeFormats?.code)) {
flag = true; flag = true;
} }
} }
@ -335,7 +355,7 @@ class VideoDetailController extends GetxController
/// 取出符合当前解码格式的videoItem /// 取出符合当前解码格式的videoItem
try { try {
firstVideo = videosList.firstWhere( firstVideo = videosList.firstWhere(
(e) => e.codecs!.startsWith(currentDecodeFormats.code)); (e) => e.codecs!.startsWith(currentDecodeFormats?.code));
} catch (_) { } catch (_) {
firstVideo = videosList.first; firstVideo = videosList.first;
} }
@ -525,4 +545,10 @@ class VideoDetailController extends GetxController
}, },
); );
} }
void updateCover(String? pic) {
if (pic != null && pic != '') {
cover.value = videoItem['pic'] = pic;
}
}
} }

View File

@ -90,6 +90,7 @@ class VideoIntroController extends GetxController {
final VideoDetailController videoDetailCtr = final VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: heroTag); Get.find<VideoDetailController>(tag: heroTag);
videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}']; videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
videoDetailCtr.cover.value = result['data'].pic ?? '';
// 获取到粉丝数再返回 // 获取到粉丝数再返回
await queryUserStat(); await queryUserStat();
} }
@ -219,36 +220,19 @@ class VideoIntroController extends GetxController {
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
title: const Text('选择投币个数'), title: const Text('选择投币个数'),
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12), contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
content: StatefulBuilder(builder: (context, StateSetter setState) { content: StatefulBuilder(builder: (context, StateSetter setState) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [1, 2]
RadioListTile( .map(
value: 1, (e) => RadioListTile(
title: const Text('1枚'), value: e,
title: Text('$e枚'),
groupValue: _tempThemeValue, groupValue: _tempThemeValue,
onChanged: (value) { onChanged: (value) async {
_tempThemeValue = value!; _tempThemeValue = value!;
Get.appUpdate(); setState(() {});
},
),
RadioListTile(
value: 2,
title: const Text('2枚'),
groupValue: _tempThemeValue,
onChanged: (value) {
_tempThemeValue = value!;
Get.appUpdate();
},
),
],
);
}),
actions: [
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
TextButton(
onPressed: () async {
var res = await VideoHttp.coinVideo( var res = await VideoHttp.coinVideo(
bvid: bvid, multiply: _tempThemeValue); bvid: bvid, multiply: _tempThemeValue);
if (res['status']) { if (res['status']) {
@ -261,8 +245,11 @@ class VideoIntroController extends GetxController {
} }
Get.back(); Get.back();
}, },
child: const Text('确定')) ),
], )
.toList(),
);
}),
); );
}); });
} }
@ -446,7 +433,7 @@ class VideoIntroController extends GetxController {
} }
// 修改分P或番剧分集 // 修改分P或番剧分集
Future changeSeasonOrbangu(bvid, cid, aid) async { Future changeSeasonOrbangu(bvid, cid, aid, cover) async {
// 重新获取视频资源 // 重新获取视频资源
final VideoDetailController videoDetailCtr = final VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: heroTag); Get.find<VideoDetailController>(tag: heroTag);
@ -461,6 +448,7 @@ class VideoIntroController extends GetxController {
videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid); videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid);
videoDetailCtr.cid.value = cid; videoDetailCtr.cid.value = cid;
videoDetailCtr.danmakuCid.value = cid; videoDetailCtr.danmakuCid.value = cid;
videoDetailCtr.cover.value = cover;
videoDetailCtr.queryVideoUrl(); videoDetailCtr.queryVideoUrl();
// 重新请求评论 // 重新请求评论
try { try {
@ -508,6 +496,7 @@ class VideoIntroController extends GetxController {
void nextPlay() { void nextPlay() {
final List episodes = []; final List episodes = [];
bool isPages = false; bool isPages = false;
late String cover;
if (videoDetail.value.ugcSeason != null) { if (videoDetail.value.ugcSeason != null) {
final UgcSeason ugcSeason = videoDetail.value.ugcSeason!; final UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
final List<SectionItem> sections = ugcSeason.sections!; final List<SectionItem> sections = ugcSeason.sections!;
@ -524,6 +513,7 @@ class VideoIntroController extends GetxController {
final int currentIndex = final int currentIndex =
episodes.indexWhere((e) => e.cid == lastPlayCid.value); episodes.indexWhere((e) => e.cid == lastPlayCid.value);
int nextIndex = currentIndex + 1; int nextIndex = currentIndex + 1;
cover = episodes[nextIndex].cover;
final VideoDetailController videoDetailCtr = final VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: heroTag); Get.find<VideoDetailController>(tag: heroTag);
final PlayRepeat platRepeat = videoDetailCtr.plPlayerController.playRepeat; final PlayRepeat platRepeat = videoDetailCtr.plPlayerController.playRepeat;
@ -540,7 +530,7 @@ class VideoIntroController extends GetxController {
final int cid = episodes[nextIndex].cid!; final int cid = episodes[nextIndex].cid!;
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid; final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!; final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
changeSeasonOrbangu(rBvid, cid, rAid); changeSeasonOrbangu(rBvid, cid, rAid, cover);
} }
// 设置关注分组 // 设置关注分组
@ -605,10 +595,11 @@ class VideoIntroController extends GetxController {
isFullScreen: true, isFullScreen: true,
changeFucCall: (item, index) { changeFucCall: (item, index) {
if (dataType == VideoEpidoesType.videoEpisode) { if (dataType == VideoEpidoesType.videoEpisode) {
changeSeasonOrbangu(IdUtils.av2bv(item.aid), item.cid, item.aid); changeSeasonOrbangu(
IdUtils.av2bv(item.aid), item.cid, item.aid, item.cover);
} }
if (dataType == VideoEpidoesType.videoPart) { if (dataType == VideoEpidoesType.videoPart) {
changeSeasonOrbangu(bvid, item.cid, null); changeSeasonOrbangu(bvid, item.cid, null, item.cover);
} }
SmartDialog.dismiss(); SmartDialog.dismiss();
}, },

View File

@ -22,6 +22,7 @@ import 'widgets/fav_panel.dart';
import 'widgets/intro_detail.dart'; import 'widgets/intro_detail.dart';
import 'widgets/page_panel.dart'; import 'widgets/page_panel.dart';
import 'widgets/season_panel.dart'; import 'widgets/season_panel.dart';
import 'widgets/staff_up_item.dart';
class VideoIntroPanel extends StatefulWidget { class VideoIntroPanel extends StatefulWidget {
final String bvid; final String bvid;
@ -380,11 +381,12 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? videoIntroController.lastPlayCid.value ? videoIntroController.lastPlayCid.value
: widget.videoDetail!.pages!.first.cid, : widget.videoDetail!.pages!.first.cid,
sheetHeight: videoDetailCtr.sheetHeight.value, sheetHeight: videoDetailCtr.sheetHeight.value,
changeFuc: (bvid, cid, aid) => changeFuc: (bvid, cid, aid, cover) =>
videoIntroController.changeSeasonOrbangu( videoIntroController.changeSeasonOrbangu(
bvid, bvid,
cid, cid,
aid, aid,
cover,
), ),
videoIntroCtr: videoIntroController, videoIntroCtr: videoIntroController,
), ),
@ -398,19 +400,23 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
pages: widget.videoDetail!.pages!, pages: widget.videoDetail!.pages!,
cid: videoIntroController.lastPlayCid.value, cid: videoIntroController.lastPlayCid.value,
sheetHeight: videoDetailCtr.sheetHeight.value, sheetHeight: videoDetailCtr.sheetHeight.value,
changeFuc: (cid) => videoIntroController.changeSeasonOrbangu( changeFuc: (cid, cover) =>
videoIntroController.changeSeasonOrbangu(
videoIntroController.bvid, videoIntroController.bvid,
cid, cid,
null, null,
cover,
), ),
videoIntroCtr: videoIntroController, videoIntroCtr: videoIntroController,
), ),
) )
], ],
if (widget.videoDetail!.staff == null)
GestureDetector( GestureDetector(
onTap: onPushMember, onTap: onPushMember,
child: Container( child: Container(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 4), padding:
const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
child: Row( child: Row(
children: [ children: [
NetworkImgLayer( NetworkImgLayer(
@ -458,7 +464,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
child: Text( child: Text(
isFollowed ? '已关注' : '关注', isFollowed ? '已关注' : '关注',
style: TextStyle( style: TextStyle(
fontSize: t.textTheme.labelMedium!.fontSize, fontSize:
t.textTheme.labelMedium!.fontSize,
), ),
), ),
), ),
@ -469,6 +476,52 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
), ),
), ),
if (widget.videoDetail!.staff != null) ...[
const SizedBox(height: 15),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text.rich(
TextSpan(
style: TextStyle(
fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
),
children: [
TextSpan(
text: '创作团队',
style: Theme.of(context)
.textTheme
.titleSmall!
.copyWith(fontWeight: FontWeight.bold),
),
const WidgetSpan(child: SizedBox(width: 6)),
TextSpan(
text: '${widget.videoDetail!.staff!.length}',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
)
],
),
),
SizedBox(
height: 120,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
for (int i = 0;
i < widget.videoDetail!.staff!.length;
i++) ...[
StaffUpItem(item: widget.videoDetail!.staff![i])
],
],
),
),
],
),
]
], ],
)), )),
); );
@ -535,4 +588,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
); );
}); });
} }
// Widget StaffPanel(BuildContext context, videoIntroController) {
// return
// }
} }

View File

@ -23,6 +23,8 @@ class IntroDetail extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
const SizedBox(height: 4), const SizedBox(height: 4),
Row(
children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!)); Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
@ -31,9 +33,25 @@ class IntroDetail extends StatelessWidget {
child: Text( child: Text(
videoDetail!.bvid!, videoDetail!.bvid!,
style: TextStyle( style: TextStyle(
fontSize: 13, color: Theme.of(context).colorScheme.primary), fontSize: 13,
color: Theme.of(context).colorScheme.primary),
), ),
), ),
const SizedBox(width: 10),
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
SmartDialog.showToast('已复制');
},
child: Text(
videoDetail!.aid!.toString(),
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.primary),
),
)
],
),
const SizedBox(height: 4), const SizedBox(height: 4),
Text.rich( Text.rich(
style: const TextStyle(height: 1.4), style: const TextStyle(height: 1.4),

View File

@ -58,7 +58,7 @@ class _PagesPanelState extends State<PagesPanel> {
} }
void changeFucCall(item, i) async { void changeFucCall(item, i) async {
widget.changeFuc?.call(item.cid); widget.changeFuc?.call(item.cid, item.cover);
currentIndex.value = i; currentIndex.value = i;
_bottomSheetController?.close(); _bottomSheetController?.close();
scrollToIndex(); scrollToIndex();
@ -129,7 +129,7 @@ class _PagesPanelState extends State<PagesPanel> {
), ),
), ),
Container( Container(
height: 35, height: 55,
margin: const EdgeInsets.only(bottom: 8), margin: const EdgeInsets.only(bottom: 8),
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -163,7 +163,7 @@ class _PagesPanelState extends State<PagesPanel> {
Expanded( Expanded(
child: Text( child: Text(
widget.pages[i].pagePart!, widget.pages[i].pagePart!,
maxLines: 1, maxLines: 2,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: isCurrentIndex color: isCurrentIndex

View File

@ -67,6 +67,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
IdUtils.av2bv(item.aid), IdUtils.av2bv(item.aid),
item.cid, item.cid,
item.aid, item.aid,
item.cover,
); );
currentIndex.value = i; currentIndex.value = i;
_bottomSheetController?.close(); _bottomSheetController?.close();

View File

@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/video_detail_res.dart';
import 'package:pilipala/utils/utils.dart';
class StaffUpItem extends StatelessWidget {
final Staff item;
const StaffUpItem({
super.key,
required this.item,
});
@override
Widget build(BuildContext context) {
final String heroTag = Utils.makeHeroTag(item.mid);
return Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 15),
GestureDetector(
onTap: () => Get.toNamed(
'/member?mid=${item.mid}',
arguments: {'face': item.face, 'heroTag': heroTag},
),
child: Hero(
tag: heroTag,
child: NetworkImgLayer(
width: 45,
height: 45,
src: item.face,
type: 'avatar',
),
),
),
Padding(
padding: const EdgeInsets.only(top: 4),
child: SizedBox(
width: 85,
child: Text(
item.name!,
overflow: TextOverflow.ellipsis,
softWrap: false,
textAlign: TextAlign.center,
style: TextStyle(
color: item.vip!.status == 1
? const Color.fromARGB(255, 251, 100, 163)
: null,
),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 4),
child: SizedBox(
width: 85,
child: Text(
item.title!,
overflow: TextOverflow.ellipsis,
softWrap: false,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
fontSize: 12,
),
),
),
),
],
);
}
}

View File

@ -37,6 +37,7 @@ class VideoReplyController extends GetxController {
RxString sortTypeLabel = ReplySortType.time.labels.obs; RxString sortTypeLabel = ReplySortType.time.labels.obs;
Box setting = GStrorage.setting; Box setting = GStrorage.setting;
RxInt replyReqCode = 200.obs;
@override @override
void onInit() { void onInit() {
@ -106,6 +107,7 @@ class VideoReplyController extends GetxController {
replyList.addAll(replies); replyList.addAll(replies);
} }
} }
replyReqCode.value = res['code'];
isLoadingMore = false; isLoadingMore = false;
return res; return res;
} }

View File

@ -117,7 +117,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
videoDetailCtr.oid.value = replyItem.oid; videoDetailCtr.oid.value = replyItem.oid;
videoDetailCtr.fRpid = replyItem.rpid!; videoDetailCtr.fRpid = replyItem.rpid!;
videoDetailCtr.firstFloor = replyItem; videoDetailCtr.firstFloor = replyItem;
videoDetailCtr.showReplyReplyPanel(); videoDetailCtr.showReplyReplyPanel(
replyItem.oid, replyItem.rpid!, replyItem);
} }
} }
@ -276,7 +277,10 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
parent: fabAnimationCtr, parent: fabAnimationCtr,
curve: Curves.easeInOut, curve: Curves.easeInOut,
)), )),
child: FloatingActionButton( child: Obx(
() => _videoReplyController.replyReqCode.value == 12061
? const SizedBox()
: FloatingActionButton(
heroTag: null, heroTag: null,
onPressed: () { onPressed: () {
feedBack(); feedBack();
@ -296,7 +300,10 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
(value) => { (value) => {
// 完成评论,数据添加 // 完成评论,数据添加
if (value != null && value['data'] != null) if (value != null && value['data'] != null)
{_videoReplyController.replyList.add(value['data'])} {
_videoReplyController.replyList
.add(value['data'])
}
}, },
); );
}, },
@ -305,6 +312,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
), ),
), ),
), ),
),
], ],
), ),
); );

View File

@ -12,7 +12,6 @@ import 'package:pilipala/pages/preview/index.dart';
import 'package:pilipala/pages/video/detail/index.dart'; import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/reply_new/index.dart'; import 'package:pilipala/pages/video/detail/reply_new/index.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/url_utils.dart'; import 'package:pilipala/utils/url_utils.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
@ -45,7 +44,7 @@ class ReplyItem extends StatelessWidget {
onTap: () { onTap: () {
feedBack(); feedBack();
if (replyReply != null) { if (replyReply != null) {
replyReply!(replyItem); replyReply!(replyItem, null);
} }
}, },
onLongPress: () { onLongPress: () {
@ -59,28 +58,23 @@ class ReplyItem extends StatelessWidget {
}, },
); );
}, },
child: Column( child: Container(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(12, 14, 8, 5), padding: const EdgeInsets.fromLTRB(12, 14, 8, 5),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.5),
))),
child: content(context), child: content(context),
), ),
Divider(
indent: 55,
endIndent: 15,
height: 0.3,
color: Theme.of(context)
.colorScheme
.onInverseSurface
.withOpacity(0.5),
)
],
),
), ),
); );
} }
Widget lfAvtar(BuildContext context, String heroTag) { Widget lfAvtar(BuildContext context, String heroTag) {
ColorScheme colorScheme = Theme.of(context).colorScheme;
return Stack( return Stack(
children: [ children: [
Hero( Hero(
@ -100,11 +94,11 @@ class ReplyItem extends StatelessWidget {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
color: Theme.of(context).colorScheme.background, color: colorScheme.background,
), ),
child: Icon( child: Icon(
Icons.offline_bolt, Icons.offline_bolt,
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
size: 16, size: 16,
), ),
), ),
@ -117,7 +111,7 @@ class ReplyItem extends StatelessWidget {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
color: Theme.of(context).colorScheme.background, color: colorScheme.background,
), ),
child: Image.asset( child: Image.asset(
'assets/images/big-vip.png', 'assets/images/big-vip.png',
@ -131,6 +125,8 @@ class ReplyItem extends StatelessWidget {
Widget content(BuildContext context) { Widget content(BuildContext context) {
final String heroTag = Utils.makeHeroTag(replyItem!.mid); final String heroTag = Utils.makeHeroTag(replyItem!.mid);
ColorScheme colorScheme = Theme.of(context).colorScheme;
TextTheme textTheme = Theme.of(context).textTheme;
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -160,16 +156,17 @@ class ReplyItem extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: replyItem!.member!.vip!['vipStatus'] > 0 color: replyItem!.member!.vip!['vipStatus'] > 0
? const Color.fromARGB(255, 251, 100, 163) ? const Color.fromARGB(255, 251, 100, 163)
: Theme.of(context).colorScheme.outline, : colorScheme.outline,
fontSize: 13, fontSize: 13,
), ),
), ),
const SizedBox(width: 6), Padding(
Image.asset( padding: const EdgeInsets.only(left: 6, right: 6),
child: Image.asset(
'assets/images/lv/lv${replyItem!.member!.level}.png', 'assets/images/lv/lv${replyItem!.member!.level}.png',
height: 11, height: 11,
), ),
const SizedBox(width: 6), ),
if (replyItem!.isUp!) if (replyItem!.isUp!)
const PBadge( const PBadge(
text: 'UP', text: 'UP',
@ -184,9 +181,8 @@ class ReplyItem extends StatelessWidget {
Text( Text(
Utils.dateFormat(replyItem!.ctime), Utils.dateFormat(replyItem!.ctime),
style: TextStyle( style: TextStyle(
fontSize: fontSize: textTheme.labelSmall!.fontSize,
Theme.of(context).textTheme.labelSmall!.fontSize, color: colorScheme.outline,
color: Theme.of(context).colorScheme.outline,
), ),
), ),
if (replyItem!.replyControl != null && if (replyItem!.replyControl != null &&
@ -194,11 +190,8 @@ class ReplyItem extends StatelessWidget {
Text( Text(
'${replyItem!.replyControl!.location!}', '${replyItem!.replyControl!.location!}',
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context) fontSize: textTheme.labelSmall!.fontSize,
.textTheme color: colorScheme.outline),
.labelSmall!
.fontSize,
color: Theme.of(context).colorScheme.outline),
), ),
], ],
) )
@ -256,6 +249,8 @@ class ReplyItem extends StatelessWidget {
// 感谢、回复、复制 // 感谢、回复、复制
Widget bottonAction(BuildContext context, replyControl) { Widget bottonAction(BuildContext context, replyControl) {
ColorScheme colorScheme = Theme.of(context).colorScheme;
TextTheme textTheme = Theme.of(context).textTheme;
return Row( return Row(
children: <Widget>[ children: <Widget>[
const SizedBox(width: 32), const SizedBox(width: 32),
@ -287,15 +282,13 @@ class ReplyItem extends StatelessWidget {
}, },
child: Row(children: [ child: Row(children: [
Icon(Icons.reply, Icon(Icons.reply,
size: 18, size: 18, color: colorScheme.outline.withOpacity(0.8)),
color:
Theme.of(context).colorScheme.outline.withOpacity(0.8)),
const SizedBox(width: 3), const SizedBox(width: 3),
Text( Text(
'回复', '回复',
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, fontSize: textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline, color: colorScheme.outline,
), ),
), ),
]), ]),
@ -306,8 +299,8 @@ class ReplyItem extends StatelessWidget {
Text( Text(
'up主觉得很赞', 'up主觉得很赞',
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize), fontSize: textTheme.labelMedium!.fontSize),
), ),
const SizedBox(width: 2), const SizedBox(width: 2),
], ],
@ -316,8 +309,8 @@ class ReplyItem extends StatelessWidget {
Text( Text(
'热评', '热评',
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize), fontSize: textTheme.labelMedium!.fontSize),
), ),
const Spacer(), const Spacer(),
ZanButton(replyItem: replyItem, replyType: replyType), ZanButton(replyItem: replyItem, replyType: replyType),
@ -347,10 +340,13 @@ class ReplyItemRow extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final bool isShow = replyControl!.isShow!; final bool isShow = replyControl!.isShow!;
final int extraRow = replyControl != null && isShow ? 1 : 0; final int extraRow = replyControl != null && isShow ? 1 : 0;
ColorScheme colorScheme = Theme.of(context).colorScheme;
TextTheme textTheme = Theme.of(context).textTheme;
return Container( return Container(
margin: const EdgeInsets.only(left: 42, right: 4, top: 0), margin: const EdgeInsets.only(left: 42, right: 4, top: 0),
child: Material( child: Material(
color: Theme.of(context).colorScheme.onInverseSurface, color: colorScheme.onInverseSurface,
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
animationDuration: Duration.zero, animationDuration: Duration.zero,
@ -361,7 +357,9 @@ class ReplyItemRow extends StatelessWidget {
for (int i = 0; i < replies!.length; i++) ...[ for (int i = 0; i < replies!.length; i++) ...[
InkWell( InkWell(
// 一楼点击评论展开评论详情 // 一楼点击评论展开评论详情
onTap: () => replyReply!(replyItem), // onTap: () {
// replyReply?.call(replyItem, replies![i]);
// },
onLongPress: () { onLongPress: () {
feedBack(); feedBack();
showModalBottomSheet( showModalBottomSheet(
@ -379,7 +377,7 @@ class ReplyItemRow extends StatelessWidget {
8, 8,
i == 0 && (extraRow == 1 || replies!.length > 1) ? 8 : 5, i == 0 && (extraRow == 1 || replies!.length > 1) ? 8 : 5,
8, 8,
i == 0 && (extraRow == 1 || replies!.length > 1) ? 5 : 6, 6,
), ),
child: Text.rich( child: Text.rich(
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -393,7 +391,7 @@ class ReplyItemRow extends StatelessWidget {
.textTheme .textTheme
.titleSmall! .titleSmall!
.fontSize, .fontSize,
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
@ -436,8 +434,7 @@ class ReplyItemRow extends StatelessWidget {
child: Text.rich( child: Text.rich(
TextSpan( TextSpan(
style: TextStyle( style: TextStyle(
fontSize: fontSize: textTheme.labelMedium!.fontSize,
Theme.of(context).textTheme.labelMedium!.fontSize,
), ),
children: [ children: [
if (replyControl!.upReply!) if (replyControl!.upReply!)
@ -445,7 +442,7 @@ class ReplyItemRow extends StatelessWidget {
TextSpan( TextSpan(
text: replyControl!.entryText!, text: replyControl!.entryText!,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
) )
], ],
@ -464,6 +461,7 @@ InlineSpan buildContent(
BuildContext context, replyItem, replyReply, fReplyItem) { BuildContext context, replyItem, replyReply, fReplyItem) {
final String routePath = Get.currentRoute; final String routePath = Get.currentRoute;
bool isVideoPage = routePath.startsWith('/video'); bool isVideoPage = routePath.startsWith('/video');
ColorScheme colorScheme = Theme.of(context).colorScheme;
// replyItem 当前回复内容 // replyItem 当前回复内容
// replyReply 查看二楼回复(回复详情)回调 // replyReply 查看二楼回复(回复详情)回调
@ -564,7 +562,7 @@ InlineSpan buildContent(
TextSpan( TextSpan(
text: matchStr, text: matchStr,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
@ -584,7 +582,7 @@ InlineSpan buildContent(
text: ' $matchStr ', text: ' $matchStr ',
style: isVideoPage style: isVideoPage
? TextStyle( ? TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
) )
: null, : null,
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
@ -624,14 +622,14 @@ InlineSpan buildContent(
child: Image.network( child: Image.network(
content.jumpUrl[matchStr]['prefix_icon'], content.jumpUrl[matchStr]['prefix_icon'],
height: 19, height: 19,
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
) )
], ],
TextSpan( TextSpan(
text: content.jumpUrl[matchStr]['title'], text: content.jumpUrl[matchStr]['title'],
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () async { ..onTap = () async {
@ -721,7 +719,7 @@ InlineSpan buildContent(
TextSpan( TextSpan(
text: matchStr, text: matchStr,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
@ -747,7 +745,7 @@ InlineSpan buildContent(
text: ' $matchStr ', text: ' $matchStr ',
style: isVideoPage style: isVideoPage
? TextStyle( ? TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
) )
: null, : null,
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
@ -786,14 +784,14 @@ InlineSpan buildContent(
child: Image.network( child: Image.network(
content.jumpUrl[patternStr]['prefix_icon'], content.jumpUrl[patternStr]['prefix_icon'],
height: 19, height: 19,
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
) )
], ],
TextSpan( TextSpan(
text: content.jumpUrl[patternStr]['title'], text: content.jumpUrl[patternStr]['title'],
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: colorScheme.primary,
), ),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
@ -997,7 +995,8 @@ class MorePanel extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color errorColor = Theme.of(context).colorScheme.error; ColorScheme colorScheme = Theme.of(context).colorScheme;
TextTheme textTheme = Theme.of(context).textTheme;
return Container( return Container(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom), padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column( child: Column(
@ -1013,7 +1012,7 @@ class MorePanel extends StatelessWidget {
width: 32, width: 32,
height: 3, height: 3,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline, color: colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))), borderRadius: const BorderRadius.all(Radius.circular(3))),
), ),
), ),
@ -1023,13 +1022,13 @@ class MorePanel extends StatelessWidget {
onTap: () async => await menuActionHandler('copyAll'), onTap: () async => await menuActionHandler('copyAll'),
minLeadingWidth: 0, minLeadingWidth: 0,
leading: const Icon(Icons.copy_all_outlined, size: 19), leading: const Icon(Icons.copy_all_outlined, size: 19),
title: Text('复制全部', style: Theme.of(context).textTheme.titleSmall), title: Text('复制全部', style: textTheme.titleSmall),
), ),
ListTile( ListTile(
onTap: () async => await menuActionHandler('copyFreedom'), onTap: () async => await menuActionHandler('copyFreedom'),
minLeadingWidth: 0, minLeadingWidth: 0,
leading: const Icon(Icons.copy_outlined, size: 19), leading: const Icon(Icons.copy_outlined, size: 19),
title: Text('自由复制', style: Theme.of(context).textTheme.titleSmall), title: Text('自由复制', style: textTheme.titleSmall),
), ),
// ListTile( // ListTile(
// onTap: () async => await menuActionHandler('block'), // onTap: () async => await menuActionHandler('block'),

View File

@ -43,6 +43,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
String toolbarType = 'input'; String toolbarType = 'input';
RxBool isForward = false.obs; RxBool isForward = false.obs;
RxBool showForward = false.obs; RxBool showForward = false.obs;
RxString message = ''.obs;
@override @override
void initState() { void initState() {
@ -80,15 +81,15 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
Future submitReplyAdd() async { Future submitReplyAdd() async {
feedBack(); feedBack();
String message = _replyContentController.text; // String message = _replyContentController.text;
var result = await VideoHttp.replyAdd( var result = await VideoHttp.replyAdd(
type: widget.replyType ?? ReplyType.video, type: widget.replyType ?? ReplyType.video,
oid: widget.oid!, oid: widget.oid!,
root: widget.root!, root: widget.root!,
parent: widget.parent!, parent: widget.parent!,
message: widget.replyItem != null && widget.replyItem!.root != 0 message: widget.replyItem != null && widget.replyItem!.root != 0
? ' 回复 @${widget.replyItem!.member!.uname!} : $message' ? ' 回复 @${widget.replyItem!.member!.uname!} : ${message.value}'
: message, : message.value,
); );
if (result['status']) { if (result['status']) {
SmartDialog.showToast(result['data']['success_toast']); SmartDialog.showToast(result['data']['success_toast']);
@ -100,7 +101,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
if (isForward.value) { if (isForward.value) {
await DynamicsHttp.dynamicCreate( await DynamicsHttp.dynamicCreate(
mid: 0, mid: 0,
rawText: message, rawText: message.value,
oid: widget.oid!, oid: widget.oid!,
scene: 5, scene: 5,
); );
@ -188,7 +189,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
child: TextField( child: TextField(
controller: _replyContentController, controller: _replyContentController,
minLines: 1, minLines: 3,
maxLines: null, maxLines: null,
autofocus: false, autofocus: false,
focusNode: replyContentFocusNode, focusNode: replyContentFocusNode,
@ -199,6 +200,9 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
fontSize: 14, fontSize: 14,
)), )),
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
onChanged: (text) {
message.value = text;
},
), ),
), ),
), ),
@ -267,11 +271,13 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
const Spacer(), const Spacer(),
SizedBox( SizedBox(
height: 36, height: 36,
child: FilledButton( child: Obx(
onPressed: () => submitReplyAdd(), () => FilledButton(
onPressed: message.isNotEmpty ? submitReplyAdd : null,
child: const Text('发送'), child: const Text('发送'),
), ),
), ),
),
], ],
), ),
), ),

View File

@ -39,7 +39,7 @@ class VideoDetailPage extends StatefulWidget {
} }
class _VideoDetailPageState extends State<VideoDetailPage> class _VideoDetailPageState extends State<VideoDetailPage>
with TickerProviderStateMixin, RouteAware { with TickerProviderStateMixin, RouteAware, WidgetsBindingObserver {
late VideoDetailController vdCtr; late VideoDetailController vdCtr;
PlPlayerController? plPlayerController; PlPlayerController? plPlayerController;
final ScrollController _extendNestCtr = ScrollController(); final ScrollController _extendNestCtr = ScrollController();
@ -62,6 +62,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
late bool autoPiP; late bool autoPiP;
late Floating floating; late Floating floating;
bool isShowing = true; bool isShowing = true;
// 生命周期监听
late final AppLifecycleListener _lifecycleListener;
late double statusHeight; late double statusHeight;
@override @override
@ -99,6 +101,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
floating = vdCtr.floating!; floating = vdCtr.floating!;
autoEnterPip(); autoEnterPip();
} }
WidgetsBinding.instance.addObserver(this);
lifecycleListener();
} }
// 获取视频资源,初始化播放器 // 获取视频资源,初始化播放器
@ -226,6 +230,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
floating.dispose(); floating.dispose();
} }
appbarStream.close(); appbarStream.close();
WidgetsBinding.instance.removeObserver(this);
_lifecycleListener.dispose();
super.dispose(); super.dispose();
} }
@ -288,6 +294,29 @@ class _VideoDetailPageState extends State<VideoDetailPage>
} }
} }
// 生命周期监听
void lifecycleListener() {
_lifecycleListener = AppLifecycleListener(
// onResume: () => _handleTransition('resume'),
// 后台
// onInactive: () => _handleTransition('inactive'),
// 在Android和iOS端不生效
// onHide: () => _handleTransition('hide'),
onShow: () => _handleTransition('show'),
onPause: () => _handleTransition('pause'),
onRestart: () => _handleTransition('restart'),
onDetach: () => _handleTransition('detach'),
);
}
void _handleTransition(String name) {
switch (name) {
case 'show' || 'restart':
plPlayerController?.danmakuController?.clear();
break;
}
}
/// 手动播放 /// 手动播放
Widget handlePlayPanel() { Widget handlePlayPanel() {
return Stack( return Stack(

View File

@ -180,13 +180,14 @@ class _HeaderControlState extends State<HeaderControl> {
'当前音质 ${widget.videoDetailCtr!.currentAudioQa!.description}', '当前音质 ${widget.videoDetailCtr!.currentAudioQa!.description}',
style: subTitleStyle), style: subTitleStyle),
), ),
if (widget.videoDetailCtr!.currentDecodeFormats != null)
ListTile( ListTile(
onTap: () => {Get.back(), showSetDecodeFormats()}, onTap: () => {Get.back(), showSetDecodeFormats()},
dense: true, dense: true,
leading: const Icon(Icons.av_timer_outlined, size: 20), leading: const Icon(Icons.av_timer_outlined, size: 20),
title: const Text('解码格式', style: titleStyle), title: const Text('解码格式', style: titleStyle),
subtitle: Text( subtitle: Text(
'当前解码格式 ${widget.videoDetailCtr!.currentDecodeFormats.description}', '当前解码格式 ${widget.videoDetailCtr!.currentDecodeFormats!.description}',
style: subTitleStyle), style: subTitleStyle),
), ),
ListTile( ListTile(
@ -445,7 +446,7 @@ class _HeaderControlState extends State<HeaderControl> {
children: [ children: [
RadioListTile( RadioListTile(
value: -1, value: -1,
title: const Text('关闭'), title: const Text('关闭'),
groupValue: tempThemeValue, groupValue: tempThemeValue,
onChanged: (value) { onChanged: (value) {
tempThemeValue = value!; tempThemeValue = value!;
@ -541,6 +542,8 @@ class _HeaderControlState extends State<HeaderControl> {
/// 可用的质量分类 /// 可用的质量分类
int userfulQaSam = 0; int userfulQaSam = 0;
if (videoInfo.dash != null) {
// dash格式视频一次请求会返回所有可播放的清晰度video
final List<VideoItem> video = videoInfo.dash!.video!; final List<VideoItem> video = videoInfo.dash!.video!;
final Set<int> idSet = {}; final Set<int> idSet = {};
for (final VideoItem item in video) { for (final VideoItem item in video) {
@ -550,6 +553,12 @@ class _HeaderControlState extends State<HeaderControl> {
userfulQaSam++; userfulQaSam++;
} }
} }
}
if (videoInfo.durl != null) {
// durl格式视频一次请求返回对应清晰度video
userfulQaSam = videoFormat.length - 1;
}
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
@ -707,7 +716,7 @@ class _HeaderControlState extends State<HeaderControl> {
void showSetDecodeFormats() { void showSetDecodeFormats() {
// 当前选中的解码格式 // 当前选中的解码格式
final VideoDecodeFormats currentDecodeFormats = final VideoDecodeFormats currentDecodeFormats =
widget.videoDetailCtr!.currentDecodeFormats; widget.videoDetailCtr!.currentDecodeFormats!;
final VideoItem firstVideo = widget.videoDetailCtr!.firstVideo; final VideoItem firstVideo = widget.videoDetailCtr!.firstVideo;
// 当前视频可用的解码格式 // 当前视频可用的解码格式
final List<FormatItem> videoFormat = videoInfo.supportFormats!; final List<FormatItem> videoFormat = videoInfo.supportFormats!;

View File

@ -101,7 +101,7 @@ class PlPlayerController {
bool _isFirstTime = true; bool _isFirstTime = true;
Timer? _timer; Timer? _timer;
late Timer? _timerForSeek; Timer? _timerForSeek;
Timer? _timerForVolume; Timer? _timerForVolume;
Timer? _timerForShowingVolume; Timer? _timerForShowingVolume;
Timer? _timerForGettingVolume; Timer? _timerForGettingVolume;
@ -335,8 +335,10 @@ class PlPlayerController {
}) { }) {
// 如果实例尚未创建,则创建一个新实例 // 如果实例尚未创建,则创建一个新实例
_instance ??= PlPlayerController._(); _instance ??= PlPlayerController._();
if (videoType != 'none') {
_instance!._playerCount.value += 1; _instance!._playerCount.value += 1;
_videoType.value = videoType; _videoType.value = videoType;
}
return _instance!; return _instance!;
} }
@ -351,7 +353,7 @@ class PlPlayerController {
// 初始化播放速度 // 初始化播放速度
double speed = 1.0, double speed = 1.0,
// 硬件加速 // 硬件加速
bool enableHA = true, bool enableHA = false,
double? width, double? width,
double? height, double? height,
Duration? duration, Duration? duration,
@ -1120,9 +1122,6 @@ class PlPlayerController {
} }
Future<void> dispose({String type = 'single'}) async { Future<void> dispose({String type = 'single'}) async {
print('dispose');
print('dispose: ${playerCount.value}');
// 每次减1最后销毁 // 每次减1最后销毁
if (type == 'single' && playerCount.value > 1) { if (type == 'single' && playerCount.value > 1) {
_playerCount.value -= 1; _playerCount.value -= 1;
@ -1132,7 +1131,6 @@ class PlPlayerController {
} }
_playerCount.value = 0; _playerCount.value = 0;
try { try {
print('dispose dispose ---------');
_timer?.cancel(); _timer?.cancel();
_timerForVolume?.cancel(); _timerForVolume?.cancel();
_timerForGettingVolume?.cancel(); _timerForGettingVolume?.cancel();

View File

@ -26,7 +26,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
static final List<MediaItem> _item = []; static final List<MediaItem> _item = [];
Box setting = GStrorage.setting; Box setting = GStrorage.setting;
bool enableBackgroundPlay = false; bool enableBackgroundPlay = false;
PlPlayerController player = PlPlayerController.getInstance(); PlPlayerController player = PlPlayerController.getInstance(videoType: 'none');
VideoPlayerServiceHandler() { VideoPlayerServiceHandler() {
revalidateSetting(); revalidateSetting();

View File

@ -18,7 +18,7 @@ class AudioSessionHandler {
session.configure(const AudioSessionConfiguration.music()); session.configure(const AudioSessionConfiguration.music());
session.interruptionEventStream.listen((event) { session.interruptionEventStream.listen((event) {
final player = PlPlayerController.getInstance(); final player = PlPlayerController.getInstance(videoType: 'none');
if (event.begin) { if (event.begin) {
if (!player.playerStatus.playing) return; if (!player.playerStatus.playing) return;
switch (event.type) { switch (event.type) {
@ -51,7 +51,7 @@ class AudioSessionHandler {
// 耳机拔出暂停 // 耳机拔出暂停
session.becomingNoisyEventStream.listen((_) { session.becomingNoisyEventStream.listen((_) {
final player = PlPlayerController.getInstance(); final player = PlPlayerController.getInstance(videoType: 'none');
if (player.playerStatus.playing) { if (player.playerStatus.playing) {
player.pause(); player.pause();
} }

View File

@ -29,8 +29,8 @@ class ShutdownTimerService {
return; return;
} }
SmartDialog.showToast("设置 $scheduledExitInMinutes 分钟后定时关闭"); SmartDialog.showToast("设置 $scheduledExitInMinutes 分钟后定时关闭");
_shutdownTimer = Timer(Duration(minutes: scheduledExitInMinutes), _shutdownTimer = Timer(
() => _shutdownDecider()); Duration(minutes: scheduledExitInMinutes), () => _shutdownDecider());
} }
void _showTimeUpButPauseDialog() { void _showTimeUpButPauseDialog() {
@ -88,7 +88,8 @@ class ShutdownTimerService {
_showShutdownDialog(); _showShutdownDialog();
return; return;
} }
PlPlayerController plPlayerController = PlPlayerController.getInstance(); PlPlayerController plPlayerController =
PlPlayerController.getInstance(videoType: 'none');
if (!exitApp && !waitForPlayingCompleted) { if (!exitApp && !waitForPlayingCompleted) {
if (!plPlayerController.playerStatus.playing) { if (!plPlayerController.playerStatus.playing) {
//仅提示用户 //仅提示用户
@ -108,19 +109,22 @@ class ShutdownTimerService {
//该方法依赖耦合实现,不够优雅 //该方法依赖耦合实现,不够优雅
isWaiting = true; isWaiting = true;
} }
void handleWaitingFinished() { void handleWaitingFinished() {
if (isWaiting) { if (isWaiting) {
_showShutdownDialog(); _showShutdownDialog();
isWaiting = false; isWaiting = false;
} }
} }
void _executeShutdown() { void _executeShutdown() {
if (exitApp) { if (exitApp) {
//退出app //退出app
exit(0); exit(0);
} else { } else {
//暂停播放 //暂停播放
PlPlayerController plPlayerController = PlPlayerController.getInstance(); PlPlayerController plPlayerController =
PlPlayerController.getInstance(videoType: 'none');
if (plPlayerController.playerStatus.playing) { if (plPlayerController.playerStatus.playing) {
plPlayerController.pause(); plPlayerController.pause();
waitForPlayingCompleted = true; waitForPlayingCompleted = true;

View File

@ -117,7 +117,7 @@ class PiliSchame {
// ignore: always_specify_types // ignore: always_specify_types
(e) => Get.toNamed<dynamic>('/video?bvid=$bvid&cid=$cid', (e) => Get.toNamed<dynamic>('/video?bvid=$bvid&cid=$cid',
arguments: <String, String?>{ arguments: <String, String?>{
'pic': null, 'pic': '',
'heroTag': heroTag, 'heroTag': heroTag,
}), }),
); );

View File

@ -109,7 +109,6 @@ class Utils {
toInt: false, toInt: false,
formatType: formatType); formatType: formatType);
} }
print('distance: $distance');
if (distance <= 60) { if (distance <= 60) {
return '刚刚'; return '刚刚';
} else if (distance <= 3600) { } else if (distance <= 3600) {