Merge branch 'main' into feature-pureBlackMode
This commit is contained in:
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
@ -445,27 +446,12 @@ class BangumiStatusWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
...ctr.followStatusList
|
||||
.map(
|
||||
(e) => ListTile(
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
@ -23,94 +24,81 @@ class IntroDetail extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
height: sheetHeight,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer
|
||||
.withOpacity(0.5),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
view: bangumiDetail!.stat!['views'],
|
||||
size: 'medium',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
danmu: bangumiDetail!.stat!['danmakus'],
|
||||
size: 'medium',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.areas!.first['name'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.publish!['pub_time_show'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.newEp!['desc'],
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'简介:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${bangumiDetail!.evaluate!}',
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'声优:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
bangumiDetail.actors,
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
view: bangumiDetail!.stat!['views'],
|
||||
size: 'medium',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
danmu: bangumiDetail!.stat!['danmakus'],
|
||||
size: 'medium',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.areas!.first['name'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.publish!['pub_time_show'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.newEp!['desc'],
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'简介:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${bangumiDetail!.evaluate!}',
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'声优:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
bangumiDetail.actors,
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@ -20,7 +20,6 @@ import '../../../models/video/reply/item.dart';
|
||||
import '../widgets/dynamic_panel.dart';
|
||||
|
||||
class DynamicDetailPage extends StatefulWidget {
|
||||
// const DynamicDetailPage({super.key});
|
||||
const DynamicDetailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -90,19 +89,22 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController = Get.put(
|
||||
DynamicDetailController(oid, replyType),
|
||||
tag: opusId.toString());
|
||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||
await _dynamicDetailController.reqHtmlByOpusId(opusId!);
|
||||
setState(() {});
|
||||
}
|
||||
} else {
|
||||
oid = moduleDynamic.major!.draw!.id!;
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (err) {
|
||||
print('err:${err.toString()}');
|
||||
}
|
||||
}
|
||||
if (!isOpusId) {
|
||||
_dynamicDetailController =
|
||||
Get.put(DynamicDetailController(oid, replyType), tag: oid.toString());
|
||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||
}
|
||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||
}
|
||||
|
||||
// 查看二级评论
|
||||
@ -132,7 +134,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
// 分页加载
|
||||
if (scrollController.position.pixels >=
|
||||
scrollController.position.maxScrollExtent - 300) {
|
||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||
EasyThrottle.throttle('replyList', const Duration(seconds: 2), () {
|
||||
_dynamicDetailController.onLoad();
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
@ -108,28 +109,12 @@ class MorePanel extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
// clipBehavior: Clip.hardEdge,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
try {
|
||||
|
||||
@ -34,6 +34,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
List<LiveUserItem> liveList = [];
|
||||
static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0);
|
||||
late MyInfo userInfo;
|
||||
RxBool showLiveUser = false.obs;
|
||||
|
||||
void listFormat() {
|
||||
userInfo = widget.upData.myInfo!;
|
||||
@ -131,21 +132,70 @@ class _UpPanelState extends State<UpPanel> {
|
||||
children: [
|
||||
const SizedBox(width: 10),
|
||||
if (liveList.isNotEmpty) ...[
|
||||
for (int i = 0; i < liveList.length; i++) ...[
|
||||
upItemBuild(liveList[i], i)
|
||||
],
|
||||
VerticalDivider(
|
||||
indent: 20,
|
||||
endIndent: 40,
|
||||
width: 26,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.5),
|
||||
Obx(
|
||||
() => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (Widget child,
|
||||
Animation<double> animation) {
|
||||
return FadeTransition(
|
||||
opacity: animation, child: child);
|
||||
},
|
||||
child: showLiveUser.value
|
||||
? Row(
|
||||
key: ValueKey<bool>(showLiveUser.value),
|
||||
children: [
|
||||
for (int i = 0;
|
||||
i < liveList.length;
|
||||
i++)
|
||||
UpItemWidget(
|
||||
data: liveList[i],
|
||||
index: i,
|
||||
currentMid: currentMid,
|
||||
onClickUp: onClickUp,
|
||||
onClickUpAni: onClickUpAni,
|
||||
itemPadding: itemPadding,
|
||||
contentWidth: contentWidth,
|
||||
)
|
||||
],
|
||||
)
|
||||
: SizedBox.shrink(
|
||||
key: ValueKey<bool>(showLiveUser.value),
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => IconButton(
|
||||
onPressed: () {
|
||||
showLiveUser.value = !showLiveUser.value;
|
||||
},
|
||||
icon: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (Widget child,
|
||||
Animation<double> animation) {
|
||||
return ScaleTransition(
|
||||
scale: animation, child: child);
|
||||
},
|
||||
child: Icon(
|
||||
!showLiveUser.value
|
||||
? Icons.arrow_forward_ios_rounded
|
||||
: Icons.arrow_back_ios_rounded,
|
||||
key: ValueKey<bool>(showLiveUser.value),
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
for (int i = 0; i < upList.length; i++) ...[
|
||||
upItemBuild(upList[i], i)
|
||||
UpItemWidget(
|
||||
data: upList[i],
|
||||
index: i,
|
||||
currentMid: currentMid,
|
||||
onClickUp: onClickUp,
|
||||
onClickUpAni: onClickUpAni,
|
||||
itemPadding: itemPadding,
|
||||
contentWidth: contentWidth,
|
||||
)
|
||||
],
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
@ -165,18 +215,103 @@ class _UpPanelState extends State<UpPanel> {
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget upItemBuild(data, i) {
|
||||
class _SliverHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
_SliverHeaderDelegate({required this.height, required this.child});
|
||||
|
||||
final double height;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return child;
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => height;
|
||||
|
||||
@override
|
||||
double get minExtent => height;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) =>
|
||||
true;
|
||||
}
|
||||
|
||||
class UpPanelSkeleton extends StatelessWidget {
|
||||
const UpPanelSkeleton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: 10,
|
||||
itemBuilder: ((context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 6),
|
||||
width: 45,
|
||||
height: 12,
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UpItemWidget extends StatelessWidget {
|
||||
final dynamic data;
|
||||
final int index;
|
||||
final RxInt currentMid;
|
||||
final Function(dynamic, int) onClickUp;
|
||||
final Function(dynamic, int) onClickUpAni;
|
||||
// final Function() feedBack;
|
||||
final EdgeInsets itemPadding;
|
||||
final double contentWidth;
|
||||
|
||||
const UpItemWidget({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required this.index,
|
||||
required this.currentMid,
|
||||
required this.onClickUp,
|
||||
required this.onClickUpAni,
|
||||
// required this.feedBack,
|
||||
required this.itemPadding,
|
||||
required this.contentWidth,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
if (data.type == 'up') {
|
||||
EasyThrottle.throttle('follow', const Duration(milliseconds: 300),
|
||||
() {
|
||||
if (GlobalDataCache().enableDynamicSwitch) {
|
||||
onClickUp(data, i);
|
||||
if (GlobalDataCache.enableDynamicSwitch) {
|
||||
onClickUp(data, index);
|
||||
} else {
|
||||
onClickUpAni(data, i);
|
||||
onClickUpAni(data, index);
|
||||
}
|
||||
});
|
||||
} else if (data.type == 'live') {
|
||||
@ -251,13 +386,12 @@ class _UpPanelState extends State<UpPanel> {
|
||||
softWrap: false,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: currentMid.value == data.mid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize),
|
||||
color: currentMid.value == data.mid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -269,64 +403,3 @@ class _UpPanelState extends State<UpPanel> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SliverHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
_SliverHeaderDelegate({required this.height, required this.child});
|
||||
|
||||
final double height;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return child;
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => height;
|
||||
|
||||
@override
|
||||
double get minExtent => height;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) =>
|
||||
true;
|
||||
}
|
||||
|
||||
class UpPanelSkeleton extends StatelessWidget {
|
||||
const UpPanelSkeleton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: 10,
|
||||
itemBuilder: ((context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 6),
|
||||
width: 45,
|
||||
height: 12,
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/common.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/user/fav_detail.dart';
|
||||
@ -8,6 +9,8 @@ import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/pages/fav/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'widget/invalid_video_card.dart';
|
||||
|
||||
class FavDetailController extends GetxController {
|
||||
FavFolderItemData? item;
|
||||
RxString title = ''.obs;
|
||||
@ -131,8 +134,9 @@ class FavDetailController extends GetxController {
|
||||
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
||||
},
|
||||
);
|
||||
title.value = res['title'];
|
||||
print(title);
|
||||
if (res != null) {
|
||||
title.value = res['title'];
|
||||
}
|
||||
}
|
||||
|
||||
Future toViewPlayAll() async {
|
||||
@ -152,4 +156,22 @@ class FavDetailController extends GetxController {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 查看无效视频信息
|
||||
Future toViewInvalidVideo(FavDetailItemData item) async {
|
||||
SmartDialog.showLoading(msg: '加载中...');
|
||||
var res = await CommonHttp.fixVideoPicAndTitle(aid: item.id!);
|
||||
SmartDialog.dismiss();
|
||||
if (res['status']) {
|
||||
showModalBottomSheet(
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: (context) {
|
||||
return InvalidVideoCard(videoInfo: res['data']);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +226,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
isOwner: _favDetailController.isOwner,
|
||||
callFn: () => _favDetailController
|
||||
.onCancelFav(favList[index].id),
|
||||
viewInvalidVideoCb: () => _favDetailController
|
||||
.toViewInvalidVideo(favList[index]),
|
||||
);
|
||||
}, childCount: favList.length),
|
||||
),
|
||||
|
||||
@ -19,6 +19,7 @@ class FavVideoCardH extends StatelessWidget {
|
||||
final Function? callFn;
|
||||
final int? searchType;
|
||||
final String isOwner;
|
||||
final Function? viewInvalidVideoCb;
|
||||
|
||||
const FavVideoCardH({
|
||||
Key? key,
|
||||
@ -26,6 +27,7 @@ class FavVideoCardH extends StatelessWidget {
|
||||
this.callFn,
|
||||
this.searchType,
|
||||
required this.isOwner,
|
||||
this.viewInvalidVideoCb,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -36,6 +38,10 @@ class FavVideoCardH extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
// int? seasonId;
|
||||
if (videoItem.title == '已失效视频') {
|
||||
viewInvalidVideoCb?.call();
|
||||
return;
|
||||
}
|
||||
String? epId;
|
||||
if (videoItem.ogv != null &&
|
||||
(videoItem.ogv['type_name'] == '番剧' ||
|
||||
@ -65,11 +71,17 @@ class FavVideoCardH extends StatelessWidget {
|
||||
epId != null ? SearchType.media_bangumi : SearchType.video,
|
||||
});
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context,
|
||||
videoItem,
|
||||
SmartDialog.dismiss,
|
||||
),
|
||||
onLongPress: () {
|
||||
if (videoItem.title == '已失效视频') {
|
||||
SmartDialog.showToast('视频已失效');
|
||||
return;
|
||||
}
|
||||
imageSaveDialog(
|
||||
context,
|
||||
videoItem,
|
||||
SmartDialog.dismiss,
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
|
||||
97
lib/pages/fav_detail/widget/invalid_video_card.dart
Normal file
97
lib/pages/fav_detail/widget/invalid_video_card.dart
Normal file
@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/common/invalid_video.dart';
|
||||
|
||||
class InvalidVideoCard extends StatelessWidget {
|
||||
const InvalidVideoCard({required this.videoInfo, Key? key}) : super(key: key);
|
||||
final InvalidVideoModel videoInfo;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const TextStyle textStyle = TextStyle(fontSize: 14.0);
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
12,
|
||||
14,
|
||||
12,
|
||||
MediaQuery.of(context).padding.bottom + 20,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
double maxWidth = constraints.maxWidth;
|
||||
double maxHeight = maxWidth * 9 / 16;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
src: videoInfo.pic,
|
||||
radius: 20,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SelectableText(
|
||||
videoInfo.title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
SelectableText(videoInfo.author!, style: textStyle),
|
||||
const SizedBox(height: 2),
|
||||
SelectableText('创建时间:${videoInfo.createdAt}', style: textStyle),
|
||||
SelectableText('更新时间:${videoInfo.lastupdate}',
|
||||
style: textStyle),
|
||||
SelectableText('分类:${videoInfo.typename}', style: textStyle),
|
||||
SelectableText(
|
||||
'投币:${videoInfo.coins} 收藏:${videoInfo.favorites}',
|
||||
style: textStyle),
|
||||
if (videoInfo.tagList != null &&
|
||||
videoInfo.tagList!.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
_buildTags(context, videoInfo.tagList),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTags(BuildContext context, List<String>? videoTags) {
|
||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
return Wrap(
|
||||
spacing: 6,
|
||||
runSpacing: 6,
|
||||
direction: Axis.horizontal,
|
||||
textDirection: TextDirection.ltr,
|
||||
children: videoTags!.map((tag) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed('/searchResult', parameters: {'keyword': tag});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceVariant.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 10),
|
||||
child: Text(
|
||||
tag,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -53,6 +53,7 @@ class FavEditController extends GetxController {
|
||||
intro: intro,
|
||||
mediaId: mediaId!,
|
||||
cover: cover,
|
||||
privacy: privacy.value,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('编辑成功');
|
||||
@ -74,4 +75,14 @@ class FavEditController extends GetxController {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
void togglePrivacy() {
|
||||
if (privacy.value == 0) {
|
||||
privacy.value = 1;
|
||||
SmartDialog.showToast('设置为私密后,只有自己可见');
|
||||
} else {
|
||||
privacy.value = 0;
|
||||
SmartDialog.showToast('设置为公开后,所有人可见');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,31 +21,22 @@ class _FavEditPageState extends State<FavEditPage> {
|
||||
appBar: AppBar(
|
||||
title: Obx(
|
||||
() => _favEditController.type.value == 'add'
|
||||
? Text(
|
||||
'新建收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)
|
||||
: Text(
|
||||
'编辑收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
? const Text('新建收藏夹')
|
||||
: const Text('编辑收藏夹'),
|
||||
),
|
||||
actions: [
|
||||
Obx(
|
||||
() => _favEditController.privacy.value == 0
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 1;
|
||||
},
|
||||
icon: const Icon(Icons.lock_open_outlined))
|
||||
: IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 0;
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.lock_outlined,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
)),
|
||||
() => IconButton(
|
||||
onPressed: _favEditController.togglePrivacy,
|
||||
icon: Icon(
|
||||
_favEditController.privacy.value == 0
|
||||
? Icons.lock_open_outlined
|
||||
: Icons.lock_outlined,
|
||||
color: _favEditController.privacy.value == 0
|
||||
? null
|
||||
: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
||||
|
||||
@ -122,6 +122,7 @@ class LaterController extends GetxController {
|
||||
'heroTag': heroTag,
|
||||
'sourceType': 'watchLater',
|
||||
'count': laterList.length,
|
||||
'mediaId': userInfo!.mid,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ class LiveRoomController extends GetxController {
|
||||
Request.getBuvid().then((value) => buvid = value);
|
||||
}
|
||||
// CDN优化
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||
final userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null && userInfo.mid != null) {
|
||||
userId = userInfo.mid;
|
||||
|
||||
@ -312,25 +312,28 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
),
|
||||
),
|
||||
// 消息列表
|
||||
Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: 90 + padding.bottom,
|
||||
),
|
||||
height: Get.size.height -
|
||||
(padding.top +
|
||||
kToolbarHeight +
|
||||
(_liveRoomController.isPortrait.value
|
||||
? Get.size.width
|
||||
: Get.size.width * 9 / 16) +
|
||||
100 +
|
||||
padding.bottom),
|
||||
child: buildMessageListUI(
|
||||
context,
|
||||
_liveRoomController,
|
||||
_scrollController,
|
||||
Visibility(
|
||||
visible: !isLandscape,
|
||||
child: Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: 90 + padding.bottom,
|
||||
),
|
||||
height: Get.size.height -
|
||||
(padding.top +
|
||||
kToolbarHeight +
|
||||
(_liveRoomController.isPortrait.value
|
||||
? Get.size.width
|
||||
: Get.size.width * 9 / 16) +
|
||||
100 +
|
||||
padding.bottom),
|
||||
child: buildMessageListUI(
|
||||
context,
|
||||
_liveRoomController,
|
||||
_scrollController,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -125,7 +125,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
||||
double sheetHeight = MediaQuery.sizeOf(context).height -
|
||||
MediaQuery.of(context).padding.top -
|
||||
MediaQuery.sizeOf(context).width * 9 / 16;
|
||||
GlobalDataCache().sheetHeight = sheetHeight;
|
||||
GlobalDataCache.sheetHeight = sheetHeight;
|
||||
localCache.put('sheetHeight', sheetHeight);
|
||||
localCache.put('statusBarHeight', statusBarHeight);
|
||||
|
||||
|
||||
@ -28,9 +28,8 @@ class MemberArchiveController extends GetxController {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
currentOrder.value = orderList.first;
|
||||
ownerMid = GlobalDataCache().userInfo != null
|
||||
? GlobalDataCache().userInfo!.mid!
|
||||
: -1;
|
||||
ownerMid =
|
||||
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
|
||||
isOwner.value = mid == -1 || mid == ownerMid;
|
||||
}
|
||||
|
||||
|
||||
@ -20,9 +20,8 @@ class MemberArticleController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
ownerMid = GlobalDataCache().userInfo != null
|
||||
? GlobalDataCache().userInfo!.mid!
|
||||
: -1;
|
||||
ownerMid =
|
||||
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
|
||||
isOwner.value = mid == -1 || mid == ownerMid;
|
||||
}
|
||||
|
||||
|
||||
@ -18,9 +18,8 @@ class MemberDynamicsController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
ownerMid = GlobalDataCache().userInfo != null
|
||||
? GlobalDataCache().userInfo!.mid!
|
||||
: -1;
|
||||
ownerMid =
|
||||
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
|
||||
isOwner.value = mid == -1 || mid == ownerMid;
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ class MemberSeasonsController extends GetxController {
|
||||
mid: mid,
|
||||
seriesId: seriesId!,
|
||||
pn: pn,
|
||||
currentMid: GlobalDataCache().userInfo?.mid ?? -1,
|
||||
currentMid: GlobalDataCache.userInfo?.mid ?? -1,
|
||||
);
|
||||
if (res['status']) {
|
||||
seasonsList.addAll(res['data'].seriesList);
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/read/opus.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
import 'text_helper.dart';
|
||||
|
||||
@ -26,16 +27,18 @@ class _OpusPageState extends State<OpusPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: _buildAppBar(),
|
||||
body: SingleChildScrollView(
|
||||
body: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:pilipala/models/read/opus.dart';
|
||||
import 'package:pilipala/models/read/read.dart';
|
||||
import 'package:pilipala/pages/opus/text_helper.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
|
||||
class ReadPage extends StatefulWidget {
|
||||
@ -38,16 +39,18 @@ class _ReadPageState extends State<ReadPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: _buildAppBar(),
|
||||
body: SingleChildScrollView(
|
||||
body: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -43,10 +43,10 @@ class SSearchController extends GetxController {
|
||||
hintText = hint;
|
||||
}
|
||||
}
|
||||
historyCacheList = GlobalDataCache().historyCacheList;
|
||||
historyCacheList = GlobalDataCache.historyCacheList;
|
||||
historyList.value = historyCacheList;
|
||||
enableHotKey = setting.get(SettingBoxKey.enableHotKey, defaultValue: true);
|
||||
enableSearchSuggest = GlobalDataCache().enableSearchSuggest;
|
||||
enableSearchSuggest = GlobalDataCache.enableSearchSuggest;
|
||||
}
|
||||
|
||||
void onChange(value) {
|
||||
@ -128,7 +128,7 @@ class SSearchController extends GetxController {
|
||||
historyCacheList = [];
|
||||
historyList.refresh();
|
||||
localCache.put('cacheList', []);
|
||||
GlobalDataCache().historyCacheList = [];
|
||||
GlobalDataCache.historyCacheList = [];
|
||||
SmartDialog.showToast('搜索历史已清空');
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class SSearchController extends GetxController {
|
||||
historyList.value = historyCacheList;
|
||||
historyList.refresh();
|
||||
localCache.put('cacheList', historyCacheList);
|
||||
GlobalDataCache().historyCacheList = historyCacheList;
|
||||
GlobalDataCache.historyCacheList = historyCacheList;
|
||||
searchFocusNode.unfocus();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/models/common/comment_range_type.dart';
|
||||
import 'package:pilipala/models/common/dynamics_type.dart';
|
||||
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||
@ -27,6 +28,8 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
late String defaultSystemProxyHost;
|
||||
late String defaultSystemProxyPort;
|
||||
bool userLogin = false;
|
||||
// 记录每个选项是否被选中的状态
|
||||
late List<String> enableComment;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -47,6 +50,8 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');
|
||||
defaultSystemProxyPort =
|
||||
localCache.get(LocalCacheKey.systemProxyPort, defaultValue: '');
|
||||
enableComment = setting
|
||||
.get(SettingBoxKey.enableComment, defaultValue: ['video', 'bangumi']);
|
||||
}
|
||||
|
||||
// 设置代理
|
||||
@ -146,7 +151,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
setKey: SettingBoxKey.enableSearchSuggest,
|
||||
defaultVal: true,
|
||||
callFn: (val) {
|
||||
GlobalDataCache().enableSearchSuggest = val;
|
||||
GlobalDataCache.enableSearchSuggest = val;
|
||||
},
|
||||
),
|
||||
SetSwitchItem(
|
||||
@ -181,7 +186,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
setKey: SettingBoxKey.enableAutoExpand,
|
||||
defaultVal: false,
|
||||
callFn: (val) {
|
||||
GlobalDataCache().enableAutoExpand = val;
|
||||
GlobalDataCache.enableAutoExpand = val;
|
||||
},
|
||||
),
|
||||
const SetSwitchItem(
|
||||
@ -190,9 +195,103 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
setKey: SettingBoxKey.enableRelatedVideo,
|
||||
defaultVal: true,
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '视频投屏开关',
|
||||
subTitle: '打开后将在播放器右上角显示投屏入口',
|
||||
setKey: SettingBoxKey.enableDlna,
|
||||
defaultVal: false,
|
||||
callFn: (bool val) {
|
||||
GlobalDataCache.enableDlna = val;
|
||||
},
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: 'Sponsor Block',
|
||||
subTitle: '自动跳过视频中赞助片段',
|
||||
setKey: SettingBoxKey.enableSponsorBlock,
|
||||
defaultVal: false,
|
||||
callFn: (bool val) {
|
||||
GlobalDataCache.enableSponsorBlock = val;
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('评论展示', style: titleStyle),
|
||||
onTap: () async {
|
||||
List<String> tempEnableComment = List.from(enableComment);
|
||||
int? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
// 带多选框的list
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
return AlertDialog(
|
||||
title: const Text('评论展示'),
|
||||
contentPadding: const EdgeInsets.fromLTRB(0, 24, 0, 24),
|
||||
content: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: ListView.builder(
|
||||
itemCount: CommentRangeType.values.length,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return CheckboxListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 24, vertical: 0),
|
||||
title: Text(
|
||||
'${CommentRangeType.values[index].label}评论'),
|
||||
value: tempEnableComment.contains(
|
||||
CommentRangeType.values[index].value),
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
if (value == true) {
|
||||
tempEnableComment.add(
|
||||
CommentRangeType.values[index].value);
|
||||
} else {
|
||||
tempEnableComment.remove(
|
||||
CommentRangeType.values[index].value);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
enableComment = tempEnableComment;
|
||||
setting.put(
|
||||
SettingBoxKey.enableComment, enableComment);
|
||||
GlobalDataCache.enableComment = enableComment;
|
||||
SmartDialog.showToast('操作成功');
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
defaultReplySort = result;
|
||||
setting.put(SettingBoxKey.replySortType, result);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('评论排序', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'当前优先展示「${ReplySortType.values[defaultReplySort].titles}」',
|
||||
style: subTitleStyle,
|
||||
@ -202,7 +301,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<int>(
|
||||
title: '评论展示',
|
||||
title: '评论排序',
|
||||
value: defaultReplySort,
|
||||
values: ReplySortType.values.map((e) {
|
||||
return {'title': e.titles, 'value': e.index};
|
||||
|
||||
@ -38,7 +38,7 @@ class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
|
||||
.map<String>((i) => (i['value'] as ActionType).value)
|
||||
.toList();
|
||||
setting.put(SettingBoxKey.actionTypeSort, sortedTabbar);
|
||||
GlobalDataCache().actionTypeSort = sortedTabbar;
|
||||
GlobalDataCache.actionTypeSort = sortedTabbar;
|
||||
SmartDialog.showToast('操作成功');
|
||||
}
|
||||
|
||||
|
||||
@ -58,11 +58,11 @@ class _PlayGesturePageState extends State<PlayGesturePage> {
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
GlobalDataCache().fullScreenGestureMode = FullScreenGestureMode
|
||||
GlobalDataCache.fullScreenGestureMode = FullScreenGestureMode
|
||||
.values
|
||||
.firstWhere((element) => element.values == result);
|
||||
fullScreenGestureMode =
|
||||
GlobalDataCache().fullScreenGestureMode.index;
|
||||
GlobalDataCache.fullScreenGestureMode.index;
|
||||
setting.put(
|
||||
SettingBoxKey.fullScreenGestureMode, fullScreenGestureMode);
|
||||
SmartDialog.showToast('设置成功');
|
||||
|
||||
@ -31,6 +31,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
late int defaultFullScreenMode;
|
||||
late int defaultBtmProgressBehavior;
|
||||
late String defaultAoOutput;
|
||||
late String hardwareDecodeFormat;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -49,6 +50,8 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
defaultValue: BtmProgresBehavior.values.first.code);
|
||||
defaultAoOutput =
|
||||
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
||||
hardwareDecodeFormat = setting.get(SettingBoxKey.hardwareDecodeFormat,
|
||||
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
|
||||
}
|
||||
|
||||
@override
|
||||
@ -92,7 +95,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
title: 'CDN优化',
|
||||
subTitle: '使用优质CDN线路',
|
||||
setKey: SettingBoxKey.enableCDN,
|
||||
defaultVal: true,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '自动播放',
|
||||
@ -155,7 +158,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
setKey: SettingBoxKey.enablePlayerControlAnimation,
|
||||
defaultVal: true,
|
||||
callFn: (bool val) {
|
||||
GlobalDataCache().enablePlayerControlAnimation = val;
|
||||
GlobalDataCache.enablePlayerControlAnimation = val;
|
||||
}),
|
||||
SetSwitchItem(
|
||||
title: '港澳台模式',
|
||||
@ -294,6 +297,34 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('硬解方式', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'当前硬解方式(--hwdec):$hardwareDecodeFormat',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
onTap: () async {
|
||||
String? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<String>(
|
||||
title: '硬解方式',
|
||||
value: hardwareDecodeFormat,
|
||||
values: ['no', 'auto-safe', 'auto', 'yes', 'auto-copy']
|
||||
.map((e) {
|
||||
return {'title': e, 'value': e};
|
||||
}).toList());
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
setting.put(SettingBoxKey.hardwareDecodeFormat, result);
|
||||
hardwareDecodeFormat = result;
|
||||
GlobalDataCache.hardwareDecodeFormat = result;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认全屏方式', style: titleStyle),
|
||||
|
||||
@ -175,7 +175,7 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
SettingBoxKey.defaultPicQa, picQuality);
|
||||
Get.back();
|
||||
settingController.picQuality.value = picQuality;
|
||||
GlobalDataCache().imgQuality = picQuality;
|
||||
GlobalDataCache.imgQuality = picQuality;
|
||||
SmartDialog.showToast('设置成功');
|
||||
},
|
||||
child: const Text('确定'),
|
||||
|
||||
@ -21,6 +21,7 @@ import 'package:pilipala/models/video/play/url.dart';
|
||||
import 'package:pilipala/models/video/reply/item.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/utils/video_utils.dart';
|
||||
@ -115,6 +116,7 @@ class VideoDetailController extends GetxController
|
||||
BottomControlType.time,
|
||||
BottomControlType.space,
|
||||
BottomControlType.fit,
|
||||
BottomControlType.speed,
|
||||
BottomControlType.fullscreen,
|
||||
].obs;
|
||||
RxDouble sheetHeight = 0.0.obs;
|
||||
@ -140,8 +142,16 @@ class VideoDetailController extends GetxController
|
||||
} else if (argMap.containsKey('pic')) {
|
||||
updateCover(argMap['pic']);
|
||||
}
|
||||
|
||||
tabCtr = TabController(length: 2, vsync: this);
|
||||
tabs.value = <String>[
|
||||
'简介',
|
||||
if (videoType == SearchType.video &&
|
||||
GlobalDataCache.enableComment.contains('video'))
|
||||
'评论',
|
||||
if (videoType == SearchType.media_bangumi &&
|
||||
GlobalDataCache.enableComment.contains('bangumi'))
|
||||
'评论'
|
||||
];
|
||||
tabCtr = TabController(length: tabs.length, vsync: this);
|
||||
autoPlay.value =
|
||||
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
||||
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: false);
|
||||
@ -159,7 +169,7 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
|
||||
// CDN优化
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||
// 预设的画质
|
||||
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
|
||||
// 预设的解码格式
|
||||
@ -198,7 +208,7 @@ class VideoDetailController extends GetxController
|
||||
});
|
||||
|
||||
/// 仅投稿视频skip
|
||||
if (videoType == SearchType.video) {
|
||||
if (videoType == SearchType.video && GlobalDataCache.enableSponsorBlock) {
|
||||
querySkipSegments();
|
||||
}
|
||||
}
|
||||
@ -477,13 +487,22 @@ class VideoDetailController extends GetxController
|
||||
if (result['status']) {
|
||||
if (result['data'].subtitles.isNotEmpty) {
|
||||
subtitles = result['data'].subtitles;
|
||||
getDanmaku(subtitles);
|
||||
getSubtitleContent(subtitles);
|
||||
}
|
||||
}
|
||||
headerControl = HeaderControl(
|
||||
controller: plPlayerController,
|
||||
videoDetailCtr: this,
|
||||
floating: floating,
|
||||
bvid: bvid,
|
||||
videoType: videoType,
|
||||
showSubtitleBtn: result['status'] && result['data'].subtitles.isNotEmpty,
|
||||
);
|
||||
plPlayerController.setHeaderControl(headerControl);
|
||||
}
|
||||
|
||||
// 获取弹幕
|
||||
Future getDanmaku(List subtitles) async {
|
||||
// 获取字幕
|
||||
Future getSubtitleContent(List subtitles) async {
|
||||
if (subtitles.isNotEmpty) {
|
||||
for (var i in subtitles) {
|
||||
final Map<String, dynamic> res = await VideoHttp.getSubtitleContent(
|
||||
@ -605,10 +624,8 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
|
||||
void toggeleWatchLaterVisible(bool val) {
|
||||
if (sourceType.value == 'watchLater' ||
|
||||
sourceType.value == 'fav' ||
|
||||
sourceType.value == 'up_archive') {
|
||||
isWatchLaterVisible.value = !isWatchLaterVisible.value;
|
||||
if (['watchLater', 'fav', 'up_archive'].contains(sourceType.value)) {
|
||||
isWatchLaterVisible.value = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import 'package:pilipala/pages/video/detail/controller.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
@ -87,19 +88,22 @@ class VideoIntroController extends GetxController {
|
||||
}
|
||||
|
||||
// 获取视频简介&分p
|
||||
Future queryVideoIntro({cover}) async {
|
||||
Future queryVideoIntro({String? cover, String? type, int? cid}) async {
|
||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (result['status']) {
|
||||
videoDetail.value = result['data']!;
|
||||
ugcSeason = result['data']!.ugcSeason;
|
||||
pages.value = result['data']!.pages!;
|
||||
lastPlayCid.value = videoDetail.value.cid!;
|
||||
if (pages.isNotEmpty) {
|
||||
lastPlayCid.value = pages.first.cid!;
|
||||
if (type == null) {
|
||||
lastPlayCid.value = cid ?? videoDetail.value.cid!;
|
||||
}
|
||||
final VideoDetailController videoDetailCtr =
|
||||
Get.find<VideoDetailController>(tag: heroTag);
|
||||
videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
|
||||
videoDetailCtr.tabs.value = [
|
||||
'简介',
|
||||
if (GlobalDataCache.enableComment.contains('video'))
|
||||
'评论 ${result['data']?.stat?.reply}'
|
||||
];
|
||||
videoDetailCtr.cover.value = cover ?? result['data'].pic ?? '';
|
||||
// 获取到粉丝数再返回
|
||||
await queryUserStat();
|
||||
@ -469,13 +473,16 @@ class VideoIntroController extends GetxController {
|
||||
// 重新请求评论
|
||||
try {
|
||||
/// 未渲染回复组件时可能异常
|
||||
final VideoReplyController videoReplyCtr =
|
||||
Get.find<VideoReplyController>(tag: heroTag);
|
||||
videoReplyCtr.aid = aid;
|
||||
videoReplyCtr.queryReplyList(type: 'init');
|
||||
if (GlobalDataCache.enableComment.contains('video')) {
|
||||
final VideoReplyController videoReplyCtr =
|
||||
Get.find<VideoReplyController>(tag: heroTag);
|
||||
videoReplyCtr.aid = aid;
|
||||
videoReplyCtr.queryReplyList(type: 'init');
|
||||
}
|
||||
} catch (_) {}
|
||||
this.bvid = bvid;
|
||||
await queryVideoIntro(cover: cover);
|
||||
// 点击切换时,优先取当前cid
|
||||
await queryVideoIntro(cover: cover, cid: cid);
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
@ -516,7 +523,7 @@ class VideoIntroController extends GetxController {
|
||||
Get.find<VideoDetailController>(tag: heroTag);
|
||||
|
||||
/// 优先稍后再看、收藏夹
|
||||
if (videoDetailCtr.isWatchLaterVisible.value) {
|
||||
if (videoDetailCtr.sourceType.value != 'normal') {
|
||||
episodes.addAll(videoDetailCtr.mediaList);
|
||||
} else if (videoDetail.value.ugcSeason != null) {
|
||||
final UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
|
||||
@ -610,6 +617,7 @@ class VideoIntroController extends GetxController {
|
||||
// 播放器底栏 选集 回调
|
||||
void showEposideHandler() {
|
||||
late List episodes;
|
||||
int currentEpisodeIndex = 0;
|
||||
VideoEpidoesType dataType = VideoEpidoesType.videoEpisode;
|
||||
if (videoDetail.value.ugcSeason != null) {
|
||||
dataType = VideoEpidoesType.videoEpisode;
|
||||
@ -618,6 +626,7 @@ class VideoIntroController extends GetxController {
|
||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||
for (int j = 0; j < episodesList.length; j++) {
|
||||
if (episodesList[j].cid == lastPlayCid.value) {
|
||||
currentEpisodeIndex = i;
|
||||
episodes = episodesList;
|
||||
continue;
|
||||
}
|
||||
@ -637,6 +646,7 @@ class VideoIntroController extends GetxController {
|
||||
sheetHeight: Get.size.height,
|
||||
isFullScreen: true,
|
||||
ugcSeason: ugcSeason,
|
||||
currentEpisodeIndex: currentEpisodeIndex,
|
||||
changeFucCall: (item, index) {
|
||||
if (dataType == VideoEpidoesType.videoEpisode) {
|
||||
changeSeasonOrbangu(
|
||||
|
||||
@ -6,8 +6,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/skeleton/video_intro.dart';
|
||||
import 'package:pilipala/common/widgets/http_error.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
@ -57,7 +57,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
videoIntroController =
|
||||
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
|
||||
_futureBuilderFuture = videoIntroController.queryVideoIntro();
|
||||
_futureBuilderFuture = videoIntroController.queryVideoIntro(type: 'init');
|
||||
videoIntroController.videoDetail.listen((value) {
|
||||
videoDetail = value;
|
||||
});
|
||||
@ -76,10 +76,8 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.data == null) {
|
||||
return const SliverToBoxAdapter(child: SizedBox());
|
||||
}
|
||||
if (snapshot.data['status']) {
|
||||
Map? data = snapshot.data;
|
||||
if (data != null && data['status']) {
|
||||
// 请求成功
|
||||
return Obx(
|
||||
() => VideoInfo(
|
||||
@ -91,25 +89,16 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
} else {
|
||||
// 请求错误
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
btnText: snapshot.data['code'] == -404 ||
|
||||
snapshot.data['code'] == 62002
|
||||
errMsg: data?['msg'] ?? '请求异常',
|
||||
btnText: (data?['code'] == -404 || data?['code'] == 62002)
|
||||
? '返回上一页'
|
||||
: null,
|
||||
fn: () => Get.back(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
child: Center(
|
||||
child: Lottie.asset(
|
||||
'assets/loading.json',
|
||||
width: 200,
|
||||
),
|
||||
),
|
||||
),
|
||||
return const SliverToBoxAdapter(
|
||||
child: VideoIntroSkeleton(),
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -169,8 +158,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
|
||||
owner = widget.videoDetail!.owner;
|
||||
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
||||
_expandableCtr = ExpandableController(
|
||||
initialExpanded: GlobalDataCache().enableAutoExpand);
|
||||
_expandableCtr =
|
||||
ExpandableController(initialExpanded: GlobalDataCache.enableAutoExpand);
|
||||
}
|
||||
|
||||
// 收藏
|
||||
@ -556,7 +545,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
}
|
||||
|
||||
Widget actionGrid(BuildContext context, videoIntroController) {
|
||||
final actionTypeSort = GlobalDataCache().actionTypeSort;
|
||||
final actionTypeSort = GlobalDataCache.actionTypeSort;
|
||||
|
||||
Map<String, Widget> menuListWidgets = {
|
||||
'like': Obx(
|
||||
|
||||
@ -27,7 +27,7 @@ class SeasonPanel extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SeasonPanelState extends State<SeasonPanel> {
|
||||
late List<EpisodeItem> episodes;
|
||||
List<EpisodeItem>? episodes;
|
||||
late int cid;
|
||||
late RxInt currentIndex = (-1).obs;
|
||||
final String heroTag = Get.arguments['heroTag'];
|
||||
@ -42,23 +42,14 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
||||
|
||||
/// 根据 cid 找到对应集,找到对应 episodes
|
||||
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||
for (int j = 0; j < episodesList.length; j++) {
|
||||
if (episodesList[j].cid == cid) {
|
||||
currentEpisodeIndex = i;
|
||||
episodes = episodesList;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
getCurrentEpisodeIndex();
|
||||
|
||||
/// 取对应 season_id 的 episodes
|
||||
getCurrentIndex();
|
||||
_videoDetailController.cid.listen((int p0) {
|
||||
cid = p0;
|
||||
getCurrentIndex();
|
||||
getCurrentEpisodeIndex();
|
||||
});
|
||||
}
|
||||
|
||||
@ -75,7 +66,10 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
|
||||
// 获取currentIndex
|
||||
void getCurrentIndex() {
|
||||
currentIndex.value = episodes.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||
if (episodes != null) {
|
||||
currentIndex.value =
|
||||
episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||
}
|
||||
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||
if (sections.length == 1 && sections.first.type == 1) {
|
||||
final List<EpisodeItem> episodesList = sections.first.episodes!;
|
||||
@ -83,6 +77,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
for (int j = 0; j < episodesList[i].pages!.length; j++) {
|
||||
if (episodesList[i].pages![j].cid == cid) {
|
||||
currentIndex.value = i;
|
||||
episodes = episodesList;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -90,6 +85,21 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取currentEpisodeIndex
|
||||
void getCurrentEpisodeIndex() {
|
||||
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||
for (int j = 0; j < episodesList.length; j++) {
|
||||
if (episodesList[j].cid == cid) {
|
||||
currentEpisodeIndex = i;
|
||||
episodes = episodesList;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Widget buildEpisodeListItem(
|
||||
EpisodeItem episode,
|
||||
int index,
|
||||
@ -137,7 +147,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
widget.videoIntroCtr.bottomSheetController =
|
||||
_bottomSheetController = EpisodeBottomSheet(
|
||||
currentCid: cid,
|
||||
episodes: episodes,
|
||||
episodes: episodes!,
|
||||
changeFucCall: changeFucCall,
|
||||
sheetHeight: widget.sheetHeight,
|
||||
dataType: VideoEpidoesType.videoEpisode,
|
||||
@ -165,7 +175,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Obx(() => Text(
|
||||
'${currentIndex.value + 1}/${episodes.length}',
|
||||
'${currentIndex.value + 1}/${episodes!.length}',
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
)),
|
||||
const SizedBox(width: 6),
|
||||
|
||||
@ -70,6 +70,13 @@ class VideoReplyController extends GetxController {
|
||||
isEnd = res['data'].cursor.isEnd ?? false;
|
||||
nextOffset = res['data'].cursor.paginationReply.nextOffset ?? "";
|
||||
if (replies.isNotEmpty) {
|
||||
/// 临时修复
|
||||
final bool flag = replyList
|
||||
.any((ReplyItemModel reply) => reply.rpid == replies.first.rpid);
|
||||
if (replies.length == 1 && flag) {
|
||||
replies.clear();
|
||||
isEnd = true;
|
||||
}
|
||||
noMore.value = isEnd ? '没有更多了' : '加载中...';
|
||||
} else {
|
||||
noMore.value =
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/reply.dart';
|
||||
import 'package:pilipala/models/common/reply_type.dart';
|
||||
@ -52,7 +53,7 @@ class ReplyItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool isOwner = int.parse(replyItem!.member!.mid!) ==
|
||||
(GlobalDataCache().userInfo?.mid ?? -1);
|
||||
(GlobalDataCache.userInfo?.mid ?? -1);
|
||||
return Material(
|
||||
child: InkWell(
|
||||
// 点击整个评论区 评论详情/回复
|
||||
@ -415,7 +416,7 @@ class ReplyItemRow extends StatelessWidget {
|
||||
onLongPress: () {
|
||||
feedBack();
|
||||
final bool isOwner = int.parse(replyItem!.member!.mid!) ==
|
||||
(GlobalDataCache().userInfo?.mid ?? -1);
|
||||
(GlobalDataCache.userInfo?.mid ?? -1);
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
@ -1117,27 +1118,12 @@ class MorePanel extends StatelessWidget {
|
||||
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
TextTheme textTheme = Theme.of(context).textTheme;
|
||||
Color errorColor = colorScheme.error;
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('copyAll'),
|
||||
minLeadingWidth: 0,
|
||||
|
||||
@ -89,9 +89,12 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
return AppBar(
|
||||
toolbarHeight: 45,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
'评论详情',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(left: 14),
|
||||
child: Text(
|
||||
'评论详情',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
@ -102,7 +105,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
const SizedBox(width: 12),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import 'package:pilipala/pages/video/detail/related/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:pilipala/services/service_locator.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:status_bar_control/status_bar_control.dart';
|
||||
|
||||
@ -205,12 +206,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
vdCtr.bottomList.insert(3, BottomControlType.episode);
|
||||
}
|
||||
}
|
||||
vdCtr.toggeleWatchLaterVisible(false);
|
||||
} else {
|
||||
if (vdCtr.bottomList.contains(BottomControlType.episode)) {
|
||||
vdCtr.bottomList.removeAt(3);
|
||||
}
|
||||
}
|
||||
vdCtr.toggeleWatchLaterVisible(!isFullScreen);
|
||||
});
|
||||
}
|
||||
|
||||
@ -553,6 +554,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
playerController: plPlayerController!,
|
||||
),
|
||||
bottomList: vdCtr.bottomList,
|
||||
fullScreenCb: (bool status) {
|
||||
if (vdCtr.videoDirection.value == 'vertical') {
|
||||
videoHeight.value = status ? Get.size.height : verticalHeight;
|
||||
}
|
||||
},
|
||||
showEposideCb: () => vdCtr.videoType == SearchType.video
|
||||
? videoIntroController.showEposideHandler()
|
||||
: bangumiIntroController.showEposideHandler(),
|
||||
@ -679,11 +685,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
expandedHeight: expandedHeight,
|
||||
backgroundColor: Colors.black,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: PopScope(
|
||||
flexibleSpace: SizedBox.expand(
|
||||
child: PopScope(
|
||||
canPop:
|
||||
plPlayerController?.isFullScreen.value != true,
|
||||
onPopInvoked: (bool didPop) {
|
||||
if (plPlayerController?.controlsLock.value ==
|
||||
true) {
|
||||
plPlayerController?.onLockControl(false);
|
||||
return;
|
||||
}
|
||||
if (plPlayerController?.isFullScreen.value ==
|
||||
true) {
|
||||
plPlayerController!
|
||||
@ -779,13 +790,20 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
);
|
||||
},
|
||||
),
|
||||
Obx(
|
||||
() => VideoReplyPanel(
|
||||
bvid: vdCtr.bvid,
|
||||
oid: vdCtr.oid.value,
|
||||
onControllerCreated: vdCtr.onControllerCreated,
|
||||
),
|
||||
)
|
||||
if ((vdCtr.videoType == SearchType.media_bangumi &&
|
||||
GlobalDataCache.enableComment
|
||||
.contains('bangumi')) ||
|
||||
(vdCtr.videoType == SearchType.video &&
|
||||
GlobalDataCache.enableComment
|
||||
.contains('video'))) ...[
|
||||
Obx(
|
||||
() => VideoReplyPanel(
|
||||
bvid: vdCtr.bvid,
|
||||
oid: vdCtr.oid.value,
|
||||
onControllerCreated: vdCtr.onControllerCreated,
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -812,9 +830,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
/// 稍后再看列表
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: vdCtr.sourceType.value == 'watchLater' ||
|
||||
vdCtr.sourceType.value == 'fav' ||
|
||||
vdCtr.sourceType.value == 'up_archive',
|
||||
visible: ['watchLater', 'fav', 'up_archive']
|
||||
.contains(vdCtr.sourceType.value),
|
||||
child: AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
curve: Curves.easeInOut,
|
||||
@ -909,6 +926,21 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
icon: const Icon(FontAwesomeIcons.arrowLeft, size: 15),
|
||||
fuc: () => Get.back(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
FontAwesomeIcons.house,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () async {
|
||||
await vdCtr.plPlayerController.dispose(type: 'all');
|
||||
if (mounted) {
|
||||
Navigator.popUntil(
|
||||
context, (Route<dynamic> route) => route.isFirst);
|
||||
}
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
ComBtn(
|
||||
icon: const Icon(Icons.history_outlined, size: 22),
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/models/video/ai.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
@ -17,21 +18,24 @@ class AiDetail extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
height: GlobalDataCache().sheetHeight,
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
height: GlobalDataCache.sheetHeight,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
const DragHandle(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
if (modelResult!.summary != '') ...[
|
||||
_buildSummaryText(modelResult!.summary!),
|
||||
const SizedBox(height: 20),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
if (modelResult!.summary != '') ...[
|
||||
_buildSummaryText(modelResult!.summary!),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
_buildOutlineList(context),
|
||||
],
|
||||
_buildOutlineList(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -40,20 +44,6 @@ class AiDetail extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).hintColor,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
height: 4,
|
||||
width: 40,
|
||||
margin: const EdgeInsets.symmetric(vertical: 16),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSummaryText(String summary) {
|
||||
return SelectableText(
|
||||
summary,
|
||||
|
||||
@ -7,7 +7,9 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:marquee/marquee.dart';
|
||||
import 'package:ns_danmaku/ns_danmaku.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/models/video/play/quality.dart';
|
||||
import 'package:pilipala/models/video/play/url.dart';
|
||||
@ -16,6 +18,7 @@ import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/introduction/widgets/menu_row.dart';
|
||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/services/shutdown_timer_service.dart';
|
||||
import '../../../../http/danmaku.dart';
|
||||
@ -30,7 +33,7 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||
this.floating,
|
||||
this.bvid,
|
||||
this.videoType,
|
||||
this.showSubtitleBtn,
|
||||
this.showSubtitleBtn = true,
|
||||
super.key,
|
||||
});
|
||||
final PlPlayerController? controller;
|
||||
@ -38,7 +41,7 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||
final Floating? floating;
|
||||
final String? bvid;
|
||||
final SearchType? videoType;
|
||||
final bool? showSubtitleBtn;
|
||||
final bool showSubtitleBtn;
|
||||
|
||||
@override
|
||||
State<HeaderControl> createState() => _HeaderControlState();
|
||||
@ -55,11 +58,12 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
final Box<dynamic> localCache = GStorage.localCache;
|
||||
final Box<dynamic> videoStorage = GStorage.video;
|
||||
late List<double> speedsList;
|
||||
double buttonSpace = 8;
|
||||
double buttonSpace = 4;
|
||||
RxBool isFullScreen = false.obs;
|
||||
late String heroTag;
|
||||
late VideoIntroController videoIntroController;
|
||||
late VideoDetailData videoDetail;
|
||||
DateTime initialTime = DateTime.now();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -101,50 +105,11 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
margin: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer
|
||||
.withOpacity(0.5),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
Expanded(
|
||||
child: Material(
|
||||
child: ListView(
|
||||
children: [
|
||||
// ListTile(
|
||||
// onTap: () {},
|
||||
// dense: true,
|
||||
// enabled: false,
|
||||
// leading:
|
||||
// const Icon(Icons.network_cell_outlined, size: 20),
|
||||
// title: Text('省流模式', style: titleStyle),
|
||||
// subtitle: Text('低画质 | 减少视频缓存', style: subTitleStyle),
|
||||
// trailing: Transform.scale(
|
||||
// scale: 0.75,
|
||||
// child: Switch(
|
||||
// thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||
// (Set<MaterialState> states) {
|
||||
// if (states.isNotEmpty &&
|
||||
// states.first == MaterialState.selected) {
|
||||
// return const Icon(Icons.done);
|
||||
// }
|
||||
// return null; // All other states will use the default thumbIcon.
|
||||
// }),
|
||||
// value: false,
|
||||
// onChanged: (value) => {},
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
final res = await UserHttp.toViewLater(
|
||||
@ -485,65 +450,6 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
});
|
||||
}
|
||||
|
||||
/// 选择倍速
|
||||
void showSetSpeedSheet() {
|
||||
final double currentSpeed = widget.controller!.playbackSpeed;
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('播放速度'),
|
||||
content: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 2,
|
||||
children: [
|
||||
for (final double i in speedsList) ...<Widget>[
|
||||
if (i == currentSpeed) ...<Widget>[
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
// setState(() => currentSpeed = i),
|
||||
await widget.controller!.setPlaybackSpeed(i);
|
||||
Get.back();
|
||||
},
|
||||
child: Text(i.toString()),
|
||||
),
|
||||
] else ...[
|
||||
FilledButton.tonal(
|
||||
onPressed: () async {
|
||||
// setState(() => currentSpeed = i),
|
||||
await widget.controller!.setPlaybackSpeed(i);
|
||||
Get.back();
|
||||
},
|
||||
child: Text(i.toString()),
|
||||
),
|
||||
]
|
||||
]
|
||||
],
|
||||
);
|
||||
}),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Get.back(),
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await widget.controller!.setDefaultSpeed();
|
||||
Get.back();
|
||||
},
|
||||
child: const Text('默认速度'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 选择画质
|
||||
void showSetVideoQa() {
|
||||
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
|
||||
@ -1143,6 +1049,16 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
);
|
||||
}
|
||||
|
||||
Stream<DateTime> _getTimeStream() {
|
||||
return Stream.periodic(const Duration(seconds: 60), (count) {
|
||||
return DateTime.now();
|
||||
});
|
||||
}
|
||||
|
||||
String _formatTime(DateTime dateTime) {
|
||||
return '${dateTime.hour}:${dateTime.minute < 10 ? '0${dateTime.minute}' : dateTime.minute}';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _ = widget.controller!;
|
||||
@ -1158,49 +1074,12 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
primary: false,
|
||||
automaticallyImplyLeading: false,
|
||||
titleSpacing: 14,
|
||||
title: Row(
|
||||
title: Column(
|
||||
children: [
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
FontAwesomeIcons.arrowLeft,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () => <Set<void>>{
|
||||
if (widget.controller!.isFullScreen.value)
|
||||
<void>{widget.controller!.triggerFullScreen(status: false)}
|
||||
else
|
||||
<void>{
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape)
|
||||
{
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
])
|
||||
},
|
||||
Get.back()
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
if (isFullScreen.value &&
|
||||
isLandscape &&
|
||||
widget.videoType == SearchType.video) ...[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
if (isFullScreen.value && isLandscape) ...[
|
||||
Row(
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 200),
|
||||
child: Obx(
|
||||
() => Text(
|
||||
videoIntroController.videoDetail.value.title ?? '',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 40),
|
||||
if (videoIntroController.isShowOnlineTotal)
|
||||
Text(
|
||||
'${videoIntroController.total.value}人正在看',
|
||||
@ -1208,158 +1087,226 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
)
|
||||
),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: StreamBuilder<DateTime>(
|
||||
stream: _getTimeStream(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
String currentTime = _formatTime(snapshot.data!);
|
||||
return Text(
|
||||
currentTime,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
);
|
||||
} else if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
// 如果Stream还未发出数据,先显示初始获取的时间
|
||||
String currentTime = _formatTime(initialTime);
|
||||
return Text(
|
||||
currentTime,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
/// TODO 网络&电量
|
||||
],
|
||||
)
|
||||
] else ...[
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
FontAwesomeIcons.house,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () async {
|
||||
// 销毁播放器实例
|
||||
await widget.controller!.dispose(type: 'all');
|
||||
if (mounted) {
|
||||
Navigator.popUntil(
|
||||
context, (Route<dynamic> route) => route.isFirst);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
// ComBtn(
|
||||
// icon: const Icon(
|
||||
// FontAwesomeIcons.cropSimple,
|
||||
// size: 15,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// fuc: () => _.screenshot(),
|
||||
// ),
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
Icons.cast,
|
||||
size: 19,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () async {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return LiveDlnaPage(
|
||||
datasource: widget.videoDetailCtr!.videoUrl);
|
||||
Row(
|
||||
children: [
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
FontAwesomeIcons.arrowLeft,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () => <Set<void>>{
|
||||
if (widget.controller!.isFullScreen.value)
|
||||
<void>{widget.controller!.triggerFullScreen(status: false)}
|
||||
else
|
||||
<void>{
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape)
|
||||
{
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
])
|
||||
},
|
||||
Get.back()
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
if (isFullScreen.value) ...[
|
||||
SizedBox(
|
||||
width: 56,
|
||||
height: 34,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => showShootDanmakuSheet(),
|
||||
child: const Text(
|
||||
'发弹幕',
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: Obx(
|
||||
() => IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () {
|
||||
_.isOpenDanmu.value = !_.isOpenDanmu.value;
|
||||
},
|
||||
icon: Icon(
|
||||
_.isOpenDanmu.value
|
||||
? Icons.subtitles_outlined
|
||||
: Icons.subtitles_off_outlined,
|
||||
size: 19,
|
||||
SizedBox(width: buttonSpace),
|
||||
if (isFullScreen.value &&
|
||||
isLandscape &&
|
||||
widget.videoType == SearchType.video) ...[
|
||||
Expanded(
|
||||
child: LayoutBuilder(builder: (context, constraints) {
|
||||
return SizedBox(
|
||||
width: constraints.maxWidth,
|
||||
height: 25,
|
||||
child: Obx(
|
||||
() => Marquee(
|
||||
text: videoIntroController.videoDetail.value.title ??
|
||||
'',
|
||||
style: const TextStyle(fontSize: 16),
|
||||
scrollAxis: Axis.horizontal,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
blankSpace: constraints.maxWidth,
|
||||
velocity: 100,
|
||||
pauseAfterRound: const Duration(seconds: 1),
|
||||
startPadding: 0,
|
||||
accelerationDuration: const Duration(seconds: 1),
|
||||
accelerationCurve: Curves.linear,
|
||||
decelerationDuration: const Duration(seconds: 1),
|
||||
decelerationCurve: Curves.easeOut,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
] else ...[
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
FontAwesomeIcons.house,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () async {
|
||||
// 销毁播放器实例
|
||||
await widget.controller!.dispose(type: 'all');
|
||||
if (context.mounted) {
|
||||
Navigator.popUntil(
|
||||
context, (Route<dynamic> route) => route.isFirst);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(width: buttonSpace),
|
||||
if (Platform.isAndroid) ...<Widget>[
|
||||
SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () async {
|
||||
bool canUsePiP = false;
|
||||
widget.controller!.hiddenControls(false);
|
||||
try {
|
||||
canUsePiP = await widget.floating!.isPipAvailable;
|
||||
} on PlatformException catch (_) {
|
||||
canUsePiP = false;
|
||||
}
|
||||
if (canUsePiP) {
|
||||
final Rational aspectRatio = Rational(
|
||||
widget.videoDetailCtr!.data.dash!.video!.first.width!,
|
||||
widget.videoDetailCtr!.data.dash!.video!.first.height!,
|
||||
],
|
||||
const Spacer(),
|
||||
if (GlobalDataCache.enableDlna) ...[
|
||||
ComBtn(
|
||||
icon: Image.asset('assets/images/video/dlna.png', width: 19),
|
||||
fuc: () async {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return LiveDlnaPage(
|
||||
datasource: widget.videoDetailCtr!.videoUrl);
|
||||
},
|
||||
);
|
||||
await widget.floating!.enable(aspectRatio: aspectRatio);
|
||||
} else {}
|
||||
},
|
||||
},
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
],
|
||||
|
||||
/// 弹幕开关(全屏时)
|
||||
if (isFullScreen.value) ...[
|
||||
SizedBox(
|
||||
width: 56,
|
||||
height: 34,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => showShootDanmakuSheet(),
|
||||
child: const Text(
|
||||
'发弹幕',
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: Obx(
|
||||
() => IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () {
|
||||
_.isOpenDanmu.value = !_.isOpenDanmu.value;
|
||||
},
|
||||
icon: Icon(
|
||||
_.isOpenDanmu.value
|
||||
? Icons.subtitles_outlined
|
||||
: Icons.subtitles_off_outlined,
|
||||
size: 19,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
],
|
||||
|
||||
/// pip
|
||||
if (Platform.isAndroid) ...<Widget>[
|
||||
SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () async {
|
||||
bool canUsePiP = false;
|
||||
widget.controller!.hiddenControls(false);
|
||||
try {
|
||||
canUsePiP = await widget.floating!.isPipAvailable;
|
||||
} on PlatformException catch (_) {
|
||||
canUsePiP = false;
|
||||
}
|
||||
if (canUsePiP) {
|
||||
final Rational aspectRatio = Rational(
|
||||
widget.videoDetailCtr!.data.dash!.video!.first.width!,
|
||||
widget
|
||||
.videoDetailCtr!.data.dash!.video!.first.height!,
|
||||
);
|
||||
await widget.floating!.enable(aspectRatio: aspectRatio);
|
||||
} else {}
|
||||
},
|
||||
icon: Image.asset(
|
||||
'assets/images/video/pip.png',
|
||||
width: 19,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
],
|
||||
|
||||
/// 字幕
|
||||
if (widget.showSubtitleBtn) ...[
|
||||
ComBtn(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.closedCaptioning,
|
||||
size: 16,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
),
|
||||
fuc: () => showSubtitleDialog(),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
],
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
Icons.picture_in_picture_outlined,
|
||||
Icons.more_vert_outlined,
|
||||
size: 19,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () => showSettingSheet(),
|
||||
),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
],
|
||||
|
||||
/// 字幕
|
||||
if (widget.showSubtitleBtn ?? true)
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
Icons.closed_caption_off,
|
||||
size: 22,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () => showSubtitleDialog(),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
Obx(
|
||||
() => SizedBox(
|
||||
width: 45,
|
||||
height: 34,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => showSetSpeedSheet(),
|
||||
child: Text(
|
||||
'${_.playbackSpeed}X',
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
ComBtn(
|
||||
icon: const Icon(
|
||||
Icons.more_vert_outlined,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
),
|
||||
fuc: () => showSettingSheet(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -85,9 +85,12 @@ class _MediaListPanelState extends State<MediaListPanel> {
|
||||
AppBar(
|
||||
toolbarHeight: 45,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
widget.panelTitle ?? '稍后再看',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Text(
|
||||
widget.panelTitle ?? '稍后再看',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
|
||||
@ -101,25 +101,11 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: SizedBox(
|
||||
width: double.infinity,
|
||||
width: double.maxFinite,
|
||||
height: 50,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: IconButton(
|
||||
onPressed: () => Get.back(),
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 18,
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
|
||||
Reference in New Issue
Block a user