Merge branch 'main' into feature-updateVideoDetailStructure
This commit is contained in:
@ -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,27 +45,52 @@ class EpisodeBottomSheet {
|
|||||||
title = '第${episode.title}话 ${episode.longTitle!}';
|
title = '第${episode.title}话 ${episode.longTitle!}';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ListTile(
|
return isFullScreen || episode?.cover == null || episode?.cover == ''
|
||||||
onTap: () {
|
? ListTile(
|
||||||
SmartDialog.showToast('切换至「$title」');
|
onTap: () {
|
||||||
changeFucCall.call(episode, index);
|
SmartDialog.showToast('切换至「$title」');
|
||||||
},
|
changeFucCall.call(episode, index);
|
||||||
dense: false,
|
},
|
||||||
leading: isCurrentIndex
|
dense: false,
|
||||||
? Image.asset(
|
leading: isCurrentIndex
|
||||||
'assets/images/live.gif',
|
? Image.asset(
|
||||||
color: primary,
|
'assets/images/live.gif',
|
||||||
height: 12,
|
color: primary,
|
||||||
)
|
height: 12,
|
||||||
: null,
|
)
|
||||||
title: Text(
|
: null,
|
||||||
title,
|
title: Text(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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildTitle() {
|
Widget buildTitle() {
|
||||||
|
|||||||
@ -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();
|
||||||
|
|
||||||
|
|||||||
@ -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),
|
||||||
|
|||||||
@ -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',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -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,64 +125,56 @@ 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,
|
onTap: () async => onPushDetail(heroTag),
|
||||||
clipBehavior: Clip.hardEdge,
|
onLongPress: () {
|
||||||
margin: EdgeInsets.zero,
|
SmartDialog.show(
|
||||||
child: GestureDetector(
|
builder: (context) => OverlayPop(
|
||||||
onLongPress: () {
|
videoItem: videoItem,
|
||||||
if (longPress != null) {
|
closeFn: () => SmartDialog.dismiss(),
|
||||||
longPress!();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// onLongPressEnd: (details) {
|
|
||||||
// if (longPressEnd != null) {
|
|
||||||
// longPressEnd!();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async => onPushDetail(heroTag),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
AspectRatio(
|
|
||||||
aspectRatio: StyleString.aspectRatio,
|
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
Hero(
|
|
||||||
tag: heroTag,
|
|
||||||
child: NetworkImgLayer(
|
|
||||||
src: videoItem.pic,
|
|
||||||
width: maxWidth,
|
|
||||||
height: maxHeight,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (videoItem.duration > 0)
|
|
||||||
if (crossAxisCount == 1) ...[
|
|
||||||
PBadge(
|
|
||||||
bottom: 10,
|
|
||||||
right: 10,
|
|
||||||
text: Utils.timeFormat(videoItem.duration),
|
|
||||||
)
|
|
||||||
] else ...[
|
|
||||||
PBadge(
|
|
||||||
bottom: 6,
|
|
||||||
right: 7,
|
|
||||||
size: 'small',
|
|
||||||
type: 'gray',
|
|
||||||
text: Utils.timeFormat(videoItem.duration),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: StyleString.aspectRatio,
|
||||||
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Hero(
|
||||||
|
tag: heroTag,
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
src: videoItem.pic,
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (videoItem.duration > 0)
|
||||||
|
if (crossAxisCount == 1) ...[
|
||||||
|
PBadge(
|
||||||
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
|
)
|
||||||
|
] else ...[
|
||||||
|
PBadge(
|
||||||
|
bottom: 6,
|
||||||
|
right: 7,
|
||||||
|
size: 'small',
|
||||||
|
type: 'gray',
|
||||||
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -196,122 +186,90 @@ 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,
|
padding: crossAxisCount == 1
|
||||||
child: Padding(
|
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
||||||
padding: crossAxisCount == 1
|
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||||
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
child: Column(
|
||||||
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Text(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
videoItem.title,
|
||||||
children: [
|
maxLines: 2,
|
||||||
Row(
|
overflow: TextOverflow.ellipsis,
|
||||||
children: [
|
),
|
||||||
Expanded(
|
if (crossAxisCount > 1) ...[
|
||||||
child: Text(
|
const SizedBox(height: 2),
|
||||||
videoItem.title,
|
VideoStat(videoItem: videoItem, crossAxisCount: crossAxisCount),
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
VideoPopupMenu(
|
|
||||||
size: 32,
|
|
||||||
iconSize: 18,
|
|
||||||
videoItem: videoItem,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (crossAxisCount > 1) ...[
|
|
||||||
const SizedBox(height: 2),
|
|
||||||
VideoStat(
|
|
||||||
videoItem: videoItem,
|
|
||||||
crossAxisCount: crossAxisCount,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
if (videoItem.goto == 'bangumi') ...[
|
|
||||||
PBadge(
|
|
||||||
text: videoItem.bangumiBadge,
|
|
||||||
stack: 'normal',
|
|
||||||
size: 'small',
|
|
||||||
type: 'line',
|
|
||||||
fs: 9,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
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(
|
|
||||||
flex: crossAxisCount == 1 ? 0 : 1,
|
|
||||||
child: Text(
|
|
||||||
videoItem.owner.name,
|
|
||||||
maxLines: 1,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (crossAxisCount == 1) ...[
|
|
||||||
Text(
|
|
||||||
' • ',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
VideoStat(
|
|
||||||
videoItem: videoItem,
|
|
||||||
crossAxisCount: crossAxisCount,
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
],
|
|
||||||
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
|
||||||
VideoPopupMenu(
|
|
||||||
size: 24,
|
|
||||||
iconSize: 14,
|
|
||||||
videoItem: videoItem,
|
|
||||||
),
|
|
||||||
] else ...[
|
|
||||||
const SizedBox(height: 24)
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
if (videoItem.goto == 'bangumi')
|
||||||
|
_buildBadge(videoItem.bangumiBadge, 'line', 9),
|
||||||
|
if (videoItem.rcmdReason?.content != null &&
|
||||||
|
videoItem.rcmdReason.content != '')
|
||||||
|
_buildBadge(videoItem.rcmdReason.content, 'color'),
|
||||||
|
if (videoItem.goto == 'picture') _buildBadge('动态', 'line', 9),
|
||||||
|
if (videoItem.isFollowed == 1) _buildBadge('已关注', 'color'),
|
||||||
|
Expanded(
|
||||||
|
flex: crossAxisCount == 1 ? 0 : 1,
|
||||||
|
child: Text(
|
||||||
|
videoItem.owner.name,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (crossAxisCount == 1) ...[
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
VideoStat(
|
||||||
|
videoItem: videoItem,
|
||||||
|
crossAxisCount: crossAxisCount,
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
if (videoItem.goto == 'av')
|
||||||
|
SizedBox(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -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,99 +310,98 @@ 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);
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
Get.back();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void blockUser() async {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||||
|
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
|
child: Text(
|
||||||
|
'点错了',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await VideoHttp.relationMod(
|
||||||
|
mid: videoItem.owner.mid,
|
||||||
|
act: 5,
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast(res['msg'] ?? '成功');
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return Container(
|
||||||
width: size,
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
height: size,
|
child: Column(
|
||||||
child: PopupMenuButton<String>(
|
mainAxisSize: MainAxisSize.min,
|
||||||
padding: EdgeInsets.zero,
|
children: [
|
||||||
icon: Icon(
|
InkWell(
|
||||||
Icons.more_vert_outlined,
|
onTap: () => Get.back(),
|
||||||
color: Theme.of(context).colorScheme.outline,
|
child: Container(
|
||||||
size: iconSize,
|
height: 35,
|
||||||
),
|
padding: const EdgeInsets.only(bottom: 2),
|
||||||
position: PopupMenuPosition.under,
|
child: Center(
|
||||||
// constraints: const BoxConstraints(maxHeight: 35),
|
child: Container(
|
||||||
onSelected: (String type) {},
|
width: 32,
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
height: 3,
|
||||||
PopupMenuItem<String>(
|
decoration: BoxDecoration(
|
||||||
onTap: () async {
|
color: Theme.of(context).colorScheme.outline,
|
||||||
var res =
|
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||||
await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
),
|
||||||
SmartDialog.showToast(res['msg']);
|
),
|
||||||
},
|
|
||||||
value: 'pause',
|
|
||||||
height: 40,
|
|
||||||
child: const Row(
|
|
||||||
children: [
|
|
||||||
Icon(Icons.watch_later_outlined, size: 16),
|
|
||||||
SizedBox(width: 6),
|
|
||||||
Text('稍后再看', style: TextStyle(fontSize: 13))
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const PopupMenuDivider(),
|
ListTile(
|
||||||
PopupMenuItem<String>(
|
onTap: () async => await menuActionHandler('block'),
|
||||||
onTap: () async {
|
minLeadingWidth: 0,
|
||||||
SmartDialog.show(
|
leading: const Icon(Icons.block, size: 19),
|
||||||
useSystem: true,
|
title: Text(
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
'拉黑up主 「${videoItem.owner.name}」',
|
||||||
builder: (BuildContext context) {
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('提示'),
|
|
||||||
content: Text(
|
|
||||||
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
|
||||||
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
|
||||||
child: Text(
|
|
||||||
'点错了',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await VideoHttp.relationMod(
|
|
||||||
mid: videoItem.owner.mid,
|
|
||||||
act: 5,
|
|
||||||
reSrc: 11,
|
|
||||||
);
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
SmartDialog.showToast(res['msg'] ?? '成功');
|
|
||||||
},
|
|
||||||
child: const Text('确认'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
value: 'pause',
|
|
||||||
height: 40,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.block, size: 16),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text('拉黑:${videoItem.owner.name}',
|
|
||||||
style: const TextStyle(fontSize: 13))
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -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'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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});
|
||||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
if (res.data['code'] == 0) {
|
||||||
if (result.code == 0) {
|
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||||
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'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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'] ?? {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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"];
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
@ -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'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,
|
||||||
groupValue: _tempThemeValue,
|
title: Text('$e枚'),
|
||||||
onChanged: (value) {
|
groupValue: _tempThemeValue,
|
||||||
_tempThemeValue = value!;
|
onChanged: (value) async {
|
||||||
Get.appUpdate();
|
_tempThemeValue = value!;
|
||||||
},
|
setState(() {});
|
||||||
),
|
var res = await VideoHttp.coinVideo(
|
||||||
RadioListTile(
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
value: 2,
|
if (res['status']) {
|
||||||
title: const Text('2枚'),
|
SmartDialog.showToast('投币成功 👏');
|
||||||
groupValue: _tempThemeValue,
|
hasCoin.value = true;
|
||||||
onChanged: (value) {
|
bangumiDetail.value.stat!['coins'] =
|
||||||
_tempThemeValue = value!;
|
bangumiDetail.value.stat!['coins'] +
|
||||||
Get.appUpdate();
|
_tempThemeValue;
|
||||||
},
|
} else {
|
||||||
),
|
SmartDialog.showToast(res['msg']);
|
||||||
],
|
}
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
actions: [
|
|
||||||
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await VideoHttp.coinVideo(
|
|
||||||
bvid: bvid, multiply: _tempThemeValue);
|
|
||||||
if (res['status']) {
|
|
||||||
SmartDialog.showToast('投币成功 👏');
|
|
||||||
hasCoin.value = true;
|
|
||||||
bangumiDetail.value.stat!['coins'] =
|
|
||||||
bangumiDetail.value.stat!['coins'] + _tempThemeValue;
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: const Text('确定'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -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!),
|
||||||
|
|||||||
@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -84,9 +84,12 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
item.bvid,
|
item.bvid,
|
||||||
item.cid,
|
item.cid,
|
||||||
item.aid,
|
item.aid,
|
||||||
|
item.cover,
|
||||||
);
|
);
|
||||||
_bottomSheetController?.close();
|
if (_bottomSheetController != null) {
|
||||||
currentIndex = i;
|
_bottomSheetController?.close();
|
||||||
|
}
|
||||||
|
currentIndex.value = i;
|
||||||
scrollToIndex();
|
scrollToIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -369,35 +369,40 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: FloatingActionButton(
|
child: Obx(
|
||||||
heroTag: null,
|
() => _dynamicDetailController.replyReqCode.value == 12061
|
||||||
onPressed: () {
|
? const SizedBox()
|
||||||
feedBack();
|
: FloatingActionButton(
|
||||||
showModalBottomSheet(
|
heroTag: null,
|
||||||
context: context,
|
onPressed: () {
|
||||||
isScrollControlled: true,
|
feedBack();
|
||||||
builder: (BuildContext context) {
|
showModalBottomSheet(
|
||||||
return VideoReplyNewDialog(
|
context: context,
|
||||||
oid: _dynamicDetailController.oid ??
|
isScrollControlled: true,
|
||||||
IdUtils.bv2av(Get.parameters['bvid']!),
|
builder: (BuildContext context) {
|
||||||
root: 0,
|
return VideoReplyNewDialog(
|
||||||
parent: 0,
|
oid: _dynamicDetailController.oid ??
|
||||||
replyType: ReplyType.values[replyType],
|
IdUtils.bv2av(Get.parameters['bvid']!),
|
||||||
);
|
root: 0,
|
||||||
},
|
parent: 0,
|
||||||
).then(
|
replyType: ReplyType.values[replyType],
|
||||||
(value) => {
|
);
|
||||||
// 完成评论,数据添加
|
},
|
||||||
if (value != null && value['data'] != null)
|
).then(
|
||||||
{
|
(value) => {
|
||||||
_dynamicDetailController.replyList.add(value['data']),
|
// 完成评论,数据添加
|
||||||
_dynamicDetailController.acount.value++
|
if (value != null && value['data'] != null)
|
||||||
}
|
{
|
||||||
},
|
_dynamicDetailController.replyList
|
||||||
);
|
.add(value['data']),
|
||||||
},
|
_dynamicDetailController.acount.value++
|
||||||
tooltip: '评论动态',
|
}
|
||||||
child: const Icon(Icons.reply),
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tooltip: '评论动态',
|
||||||
|
child: const Icon(Icons.reply),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -214,6 +214,34 @@ class UserInfoWidget extends StatelessWidget {
|
|||||||
final VoidCallback? callback;
|
final VoidCallback? callback;
|
||||||
final HomeController? ctr;
|
final HomeController? ctr;
|
||||||
|
|
||||||
|
Widget buildLoggedInWidget(context) {
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
NetworkImgLayer(
|
||||||
|
type: 'avatar',
|
||||||
|
width: 34,
|
||||||
|
height: 34,
|
||||||
|
src: userFace,
|
||||||
|
),
|
||||||
|
Positioned.fill(
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => callback?.call(),
|
||||||
|
splashColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primaryContainer
|
||||||
|
.withOpacity(0.3),
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
@ -231,31 +259,7 @@ class UserInfoWidget extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Obx(
|
Obx(
|
||||||
() => userLogin.value
|
() => userLogin.value
|
||||||
? Stack(
|
? buildLoggedInWidget(context)
|
||||||
children: [
|
|
||||||
NetworkImgLayer(
|
|
||||||
type: 'avatar',
|
|
||||||
width: 34,
|
|
||||||
height: 34,
|
|
||||||
src: userFace,
|
|
||||||
),
|
|
||||||
Positioned.fill(
|
|
||||||
child: Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () => callback?.call(),
|
|
||||||
splashColor: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primaryContainer
|
|
||||||
.withOpacity(0.3),
|
|
||||||
borderRadius: const BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: DefaultUser(callback: () => callback!()),
|
: DefaultUser(callback: () => callback!()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -402,30 +406,27 @@ 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(
|
() => Text(
|
||||||
() => Expanded(
|
|
||||||
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),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -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: '观看人数',
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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) {
|
var args = argMap['videoItem'];
|
||||||
if (keys.contains('videoItem')) {
|
updateCover(args.pic);
|
||||||
var args = argMap['videoItem'];
|
|
||||||
if (args.pic != null && 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,37 +188,43 @@ class VideoDetailController extends GetxController
|
|||||||
plPlayerController.isBuffering.value = false;
|
plPlayerController.isBuffering.value = false;
|
||||||
plPlayerController.buffered.value = Duration.zero;
|
plPlayerController.buffered.value = Duration.zero;
|
||||||
|
|
||||||
/// 根据currentVideoQa和currentDecodeFormats 重新设置videoUrl
|
if (archiveSourceType.value == 'dash') {
|
||||||
List<VideoItem> videoList =
|
/// 根据currentVideoQa和currentDecodeFormats 重新设置videoUrl
|
||||||
data.dash!.video!.where((i) => i.id == currentVideoQa.code).toList();
|
List<VideoItem> videoList =
|
||||||
try {
|
data.dash!.video!.where((i) => i.id == currentVideoQa.code).toList();
|
||||||
firstVideo = videoList
|
try {
|
||||||
.firstWhere((i) => i.codecs!.startsWith(currentDecodeFormats.code));
|
firstVideo = videoList.firstWhere(
|
||||||
} catch (_) {
|
(i) => i.codecs!.startsWith(currentDecodeFormats?.code));
|
||||||
if (currentVideoQa == VideoQuality.dolbyVision) {
|
} catch (_) {
|
||||||
firstVideo = videoList.first;
|
if (currentVideoQa == VideoQuality.dolbyVision) {
|
||||||
currentDecodeFormats =
|
firstVideo = videoList.first;
|
||||||
VideoDecodeFormatsCode.fromString(videoList.first.codecs!)!;
|
currentDecodeFormats =
|
||||||
} else {
|
VideoDecodeFormatsCode.fromString(videoList.first.codecs!)!;
|
||||||
// 当前格式不可用
|
} else {
|
||||||
currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get(
|
// 当前格式不可用
|
||||||
SettingBoxKey.defaultDecode,
|
currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get(
|
||||||
defaultValue: VideoDecodeFormats.values.last.code))!;
|
SettingBoxKey.defaultDecode,
|
||||||
firstVideo = videoList
|
defaultValue: VideoDecodeFormats.values.last.code))!;
|
||||||
.firstWhere((i) => i.codecs!.startsWith(currentDecodeFormats.code));
|
firstVideo = videoList.firstWhere(
|
||||||
|
(i) => i.codecs!.startsWith(currentDecodeFormats?.code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
videoUrl = firstVideo.baseUrl!;
|
||||||
|
|
||||||
|
/// 根据currentAudioQa 重新设置audioUrl
|
||||||
|
if (currentAudioQa != null) {
|
||||||
|
final AudioItem firstAudio = data.dash!.audio!.firstWhere(
|
||||||
|
(AudioItem i) => i.id == currentAudioQa!.code,
|
||||||
|
orElse: () => data.dash!.audio!.first,
|
||||||
|
);
|
||||||
|
audioUrl = firstAudio.baseUrl ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
videoUrl = firstVideo.baseUrl!;
|
|
||||||
|
|
||||||
/// 根据currentAudioQa 重新设置audioUrl
|
if (archiveSourceType.value == 'durl') {
|
||||||
if (currentAudioQa != null) {
|
cacheVideoQa = VideoQualityCode.toCode(currentVideoQa);
|
||||||
final AudioItem firstAudio = data.dash!.audio!.firstWhere(
|
queryVideoUrl();
|
||||||
(AudioItem i) => i.id == currentAudioQa!.code,
|
|
||||||
orElse: () => data.dash!.audio!.first,
|
|
||||||
);
|
|
||||||
audioUrl = firstAudio.baseUrl ?? '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,50 +220,36 @@ 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,
|
||||||
groupValue: _tempThemeValue,
|
title: Text('$e枚'),
|
||||||
onChanged: (value) {
|
groupValue: _tempThemeValue,
|
||||||
_tempThemeValue = value!;
|
onChanged: (value) async {
|
||||||
Get.appUpdate();
|
_tempThemeValue = value!;
|
||||||
},
|
setState(() {});
|
||||||
),
|
var res = await VideoHttp.coinVideo(
|
||||||
RadioListTile(
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
value: 2,
|
if (res['status']) {
|
||||||
title: const Text('2枚'),
|
SmartDialog.showToast('投币成功 👏');
|
||||||
groupValue: _tempThemeValue,
|
hasCoin.value = true;
|
||||||
onChanged: (value) {
|
videoDetail.value.stat!.coin =
|
||||||
_tempThemeValue = value!;
|
videoDetail.value.stat!.coin! + _tempThemeValue;
|
||||||
Get.appUpdate();
|
} else {
|
||||||
},
|
SmartDialog.showToast(res['msg']);
|
||||||
),
|
}
|
||||||
],
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
actions: [
|
|
||||||
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await VideoHttp.coinVideo(
|
|
||||||
bvid: bvid, multiply: _tempThemeValue);
|
|
||||||
if (res['status']) {
|
|
||||||
SmartDialog.showToast('投币成功 👏');
|
|
||||||
hasCoin.value = true;
|
|
||||||
videoDetail.value.stat!.coin =
|
|
||||||
videoDetail.value.stat!.coin! + _tempThemeValue;
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: const Text('确定'))
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -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();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -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,77 +400,128 @@ 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,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
GestureDetector(
|
if (widget.videoDetail!.staff == null)
|
||||||
onTap: onPushMember,
|
GestureDetector(
|
||||||
child: Container(
|
onTap: onPushMember,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
|
child: Container(
|
||||||
child: Row(
|
padding:
|
||||||
children: [
|
const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
|
||||||
NetworkImgLayer(
|
child: Row(
|
||||||
type: 'avatar',
|
children: [
|
||||||
src: widget.videoDetail!.owner!.face,
|
NetworkImgLayer(
|
||||||
width: 34,
|
type: 'avatar',
|
||||||
height: 34,
|
src: widget.videoDetail!.owner!.face,
|
||||||
fadeInDuration: Duration.zero,
|
width: 34,
|
||||||
fadeOutDuration: Duration.zero,
|
height: 34,
|
||||||
),
|
fadeInDuration: Duration.zero,
|
||||||
const SizedBox(width: 10),
|
fadeOutDuration: Duration.zero,
|
||||||
Text(owner.name, style: const TextStyle(fontSize: 13)),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text(
|
|
||||||
follower,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: t.textTheme.labelSmall!.fontSize,
|
|
||||||
color: outline,
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 10),
|
||||||
const Spacer(),
|
Text(owner.name, style: const TextStyle(fontSize: 13)),
|
||||||
Obx(
|
const SizedBox(width: 6),
|
||||||
() {
|
Text(
|
||||||
final bool isFollowed =
|
follower,
|
||||||
videoIntroController.followStatus['attribute'] != 0;
|
style: TextStyle(
|
||||||
return videoIntroController.followStatus.isEmpty
|
fontSize: t.textTheme.labelSmall!.fontSize,
|
||||||
? const SizedBox()
|
color: outline,
|
||||||
: SizedBox(
|
),
|
||||||
height: 32,
|
),
|
||||||
child: TextButton(
|
const Spacer(),
|
||||||
onPressed:
|
Obx(
|
||||||
videoIntroController.actionRelationMod,
|
() {
|
||||||
style: TextButton.styleFrom(
|
final bool isFollowed =
|
||||||
padding: const EdgeInsets.only(
|
videoIntroController.followStatus['attribute'] != 0;
|
||||||
left: 8,
|
return videoIntroController.followStatus.isEmpty
|
||||||
right: 8,
|
? const SizedBox()
|
||||||
|
: SizedBox(
|
||||||
|
height: 32,
|
||||||
|
child: TextButton(
|
||||||
|
onPressed:
|
||||||
|
videoIntroController.actionRelationMod,
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 8,
|
||||||
|
right: 8,
|
||||||
|
),
|
||||||
|
foregroundColor: isFollowed
|
||||||
|
? outline
|
||||||
|
: t.colorScheme.onPrimary,
|
||||||
|
backgroundColor: isFollowed
|
||||||
|
? t.colorScheme.onInverseSurface
|
||||||
|
: t.colorScheme.primary, // 设置按钮背景色
|
||||||
),
|
),
|
||||||
foregroundColor: isFollowed
|
child: Text(
|
||||||
? outline
|
isFollowed ? '已关注' : '关注',
|
||||||
: t.colorScheme.onPrimary,
|
style: TextStyle(
|
||||||
backgroundColor: isFollowed
|
fontSize:
|
||||||
? t.colorScheme.onInverseSurface
|
t.textTheme.labelMedium!.fontSize,
|
||||||
: t.colorScheme.primary, // 设置按钮背景色
|
),
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
isFollowed ? '已关注' : '关注',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: t.textTheme.labelMedium!.fontSize,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
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
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,16 +23,34 @@ class IntroDetail extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
GestureDetector(
|
Row(
|
||||||
onTap: () {
|
children: [
|
||||||
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
|
GestureDetector(
|
||||||
SmartDialog.showToast('已复制');
|
onTap: () {
|
||||||
},
|
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
|
||||||
child: Text(
|
SmartDialog.showToast('已复制');
|
||||||
videoDetail!.bvid!,
|
},
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
fontSize: 13, color: Theme.of(context).colorScheme.primary),
|
videoDetail!.bvid!,
|
||||||
),
|
style: TextStyle(
|
||||||
|
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(
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,32 +277,39 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
parent: fabAnimationCtr,
|
parent: fabAnimationCtr,
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
)),
|
)),
|
||||||
child: FloatingActionButton(
|
child: Obx(
|
||||||
heroTag: null,
|
() => _videoReplyController.replyReqCode.value == 12061
|
||||||
onPressed: () {
|
? const SizedBox()
|
||||||
feedBack();
|
: FloatingActionButton(
|
||||||
showModalBottomSheet(
|
heroTag: null,
|
||||||
context: context,
|
onPressed: () {
|
||||||
isScrollControlled: true,
|
feedBack();
|
||||||
builder: (BuildContext context) {
|
showModalBottomSheet(
|
||||||
return VideoReplyNewDialog(
|
context: context,
|
||||||
oid: _videoReplyController.aid ??
|
isScrollControlled: true,
|
||||||
IdUtils.bv2av(Get.parameters['bvid']!),
|
builder: (BuildContext context) {
|
||||||
root: 0,
|
return VideoReplyNewDialog(
|
||||||
parent: 0,
|
oid: _videoReplyController.aid ??
|
||||||
replyType: ReplyType.video,
|
IdUtils.bv2av(Get.parameters['bvid']!),
|
||||||
);
|
root: 0,
|
||||||
},
|
parent: 0,
|
||||||
).then(
|
replyType: ReplyType.video,
|
||||||
(value) => {
|
);
|
||||||
// 完成评论,数据添加
|
},
|
||||||
if (value != null && value['data'] != null)
|
).then(
|
||||||
{_videoReplyController.replyList.add(value['data'])}
|
(value) => {
|
||||||
},
|
// 完成评论,数据添加
|
||||||
);
|
if (value != null && value['data'] != null)
|
||||||
},
|
{
|
||||||
tooltip: '发表评论',
|
_videoReplyController.replyList
|
||||||
child: const Icon(Icons.reply),
|
.add(value['data'])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tooltip: '发表评论',
|
||||||
|
child: const Icon(Icons.reply),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -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: const EdgeInsets.fromLTRB(12, 14, 8, 5),
|
||||||
Padding(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 14, 8, 5),
|
border: Border(
|
||||||
child: content(context),
|
bottom: BorderSide(
|
||||||
),
|
width: 1,
|
||||||
Divider(
|
color:
|
||||||
indent: 55,
|
Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.5),
|
||||||
endIndent: 15,
|
))),
|
||||||
height: 0.3,
|
child: content(context),
|
||||||
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),
|
||||||
'assets/images/lv/lv${replyItem!.member!.level}.png',
|
child: Image.asset(
|
||||||
height: 11,
|
'assets/images/lv/lv${replyItem!.member!.level}.png',
|
||||||
|
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'),
|
||||||
|
|||||||
@ -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,9 +271,11 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 36,
|
height: 36,
|
||||||
child: FilledButton(
|
child: Obx(
|
||||||
onPressed: () => submitReplyAdd(),
|
() => FilledButton(
|
||||||
child: const Text('发送'),
|
onPressed: message.isNotEmpty ? submitReplyAdd : null,
|
||||||
|
child: const Text('发送'),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -180,15 +180,16 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
'当前音质 ${widget.videoDetailCtr!.currentAudioQa!.description}',
|
'当前音质 ${widget.videoDetailCtr!.currentAudioQa!.description}',
|
||||||
style: subTitleStyle),
|
style: subTitleStyle),
|
||||||
),
|
),
|
||||||
ListTile(
|
if (widget.videoDetailCtr!.currentDecodeFormats != null)
|
||||||
onTap: () => {Get.back(), showSetDecodeFormats()},
|
ListTile(
|
||||||
dense: true,
|
onTap: () => {Get.back(), showSetDecodeFormats()},
|
||||||
leading: const Icon(Icons.av_timer_outlined, size: 20),
|
dense: true,
|
||||||
title: const Text('解码格式', style: titleStyle),
|
leading: const Icon(Icons.av_timer_outlined, size: 20),
|
||||||
subtitle: Text(
|
title: const Text('解码格式', style: titleStyle),
|
||||||
'当前解码格式 ${widget.videoDetailCtr!.currentDecodeFormats.description}',
|
subtitle: Text(
|
||||||
style: subTitleStyle),
|
'当前解码格式 ${widget.videoDetailCtr!.currentDecodeFormats!.description}',
|
||||||
),
|
style: subTitleStyle),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => {Get.back(), showSetRepeat()},
|
onTap: () => {Get.back(), showSetRepeat()},
|
||||||
dense: true,
|
dense: true,
|
||||||
@ -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,16 +542,24 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
|
|
||||||
/// 可用的质量分类
|
/// 可用的质量分类
|
||||||
int userfulQaSam = 0;
|
int userfulQaSam = 0;
|
||||||
final List<VideoItem> video = videoInfo.dash!.video!;
|
if (videoInfo.dash != null) {
|
||||||
final Set<int> idSet = {};
|
// dash格式视频一次请求会返回所有可播放的清晰度video
|
||||||
for (final VideoItem item in video) {
|
final List<VideoItem> video = videoInfo.dash!.video!;
|
||||||
final int id = item.id!;
|
final Set<int> idSet = {};
|
||||||
if (!idSet.contains(id)) {
|
for (final VideoItem item in video) {
|
||||||
idSet.add(id);
|
final int id = item.id!;
|
||||||
userfulQaSam++;
|
if (!idSet.contains(id)) {
|
||||||
|
idSet.add(id);
|
||||||
|
userfulQaSam++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (videoInfo.durl != null) {
|
||||||
|
// durl格式视频一次请求返回对应清晰度video
|
||||||
|
userfulQaSam = videoFormat.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -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!;
|
||||||
|
|||||||
@ -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._();
|
||||||
_instance!._playerCount.value += 1;
|
if (videoType != 'none') {
|
||||||
_videoType.value = videoType;
|
_instance!._playerCount.value += 1;
|
||||||
|
_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();
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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() {
|
||||||
@ -59,7 +59,7 @@ class ShutdownTimerService {
|
|||||||
// Start the 10-second timer to auto close the dialog
|
// Start the 10-second timer to auto close the dialog
|
||||||
_autoCloseDialogTimer?.cancel();
|
_autoCloseDialogTimer?.cancel();
|
||||||
_autoCloseDialogTimer = Timer(const Duration(seconds: 10), () {
|
_autoCloseDialogTimer = Timer(const Duration(seconds: 10), () {
|
||||||
SmartDialog.dismiss();// Close the dialog
|
SmartDialog.dismiss(); // Close the dialog
|
||||||
_executeShutdown();
|
_executeShutdown();
|
||||||
});
|
});
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
@ -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(){
|
|
||||||
if(isWaiting){
|
void handleWaitingFinished() {
|
||||||
|
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;
|
||||||
|
|||||||
@ -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,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user