Compare commits
23 Commits
design
...
feature-da
Author | SHA1 | Date | |
---|---|---|---|
415280acb8 | |||
888f9d3d60 | |||
25c416f9bf | |||
9ec9fc2830 | |||
74f6b0ad1e | |||
3fa72f5340 | |||
c0f3b4f3a2 | |||
c6de1fa95a | |||
da9828a295 | |||
e212a32763 | |||
a20217bf39 | |||
336feb4fda | |||
53b103b853 | |||
fd54915399 | |||
157726c4c6 | |||
25272d6d1b | |||
af1163f6e0 | |||
d003f864ce | |||
dd7b226351 | |||
6c2eab86e9 | |||
d806de7d8f | |||
5cb3e578a8 | |||
8f9fbf5d41 |
@ -506,4 +506,6 @@ class Api {
|
|||||||
/// 排行榜
|
/// 排行榜
|
||||||
static const String getRankApi = "/x/web-interface/ranking/v2";
|
static const String getRankApi = "/x/web-interface/ranking/v2";
|
||||||
|
|
||||||
|
/// 取消订阅
|
||||||
|
static const String cancelSub = '/x/v3/fav/season/unfav';
|
||||||
}
|
}
|
||||||
|
@ -349,4 +349,21 @@ class UserHttp {
|
|||||||
return {'status': false, 'msg': res.data['message']};
|
return {'status': false, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 取消订阅
|
||||||
|
static Future cancelSub({required int seasonId}) async {
|
||||||
|
var res = await Request().post(
|
||||||
|
Api.cancelSub,
|
||||||
|
queryParameters: {
|
||||||
|
'platform': 'web',
|
||||||
|
'season_id': seasonId,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ void main() async {
|
|||||||
.then((_) async {
|
.then((_) async {
|
||||||
await GStrorage.init();
|
await GStrorage.init();
|
||||||
await setupServiceLocator();
|
await setupServiceLocator();
|
||||||
|
clearLogs();
|
||||||
Request();
|
Request();
|
||||||
await Request.setCookie();
|
await Request.setCookie();
|
||||||
RecommendFilter();
|
RecommendFilter();
|
||||||
|
@ -47,18 +47,23 @@ class Vip {
|
|||||||
this.status,
|
this.status,
|
||||||
this.dueDate,
|
this.dueDate,
|
||||||
this.label,
|
this.label,
|
||||||
|
this.nicknameColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
int? type;
|
int? type;
|
||||||
int? status;
|
int? status;
|
||||||
int? dueDate;
|
int? dueDate;
|
||||||
Map? label;
|
Map? label;
|
||||||
|
int? nicknameColor;
|
||||||
|
|
||||||
Vip.fromJson(Map<String, dynamic> json) {
|
Vip.fromJson(Map<String, dynamic> json) {
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
status = json['status'];
|
status = json['status'];
|
||||||
dueDate = json['due_date'];
|
dueDate = json['due_date'];
|
||||||
label = json['label'];
|
label = json['label'];
|
||||||
|
nicknameColor = json['nickname_color'] == ''
|
||||||
|
? null
|
||||||
|
: int.parse("0xFF${json['nickname_color'].replaceAll('#', '')}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,13 +55,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
..addStatusLister(playerListener)
|
..addStatusLister(playerListener)
|
||||||
..addPositionListener(videoPositionListen);
|
..addPositionListener(videoPositionListen);
|
||||||
}
|
}
|
||||||
playerController.isOpenDanmu.listen((p0) {
|
danmakuStatusListen();
|
||||||
if (p0 && !_plDanmakuController.initiated) {
|
|
||||||
_plDanmakuController.initiate(
|
|
||||||
playerController.duration.value.inMilliseconds,
|
|
||||||
playerController.position.value.inMilliseconds);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
blockTypes = playerController.blockTypes;
|
blockTypes = playerController.blockTypes;
|
||||||
showArea = playerController.showArea;
|
showArea = playerController.showArea;
|
||||||
opacityVal = playerController.opacityVal;
|
opacityVal = playerController.opacityVal;
|
||||||
@ -111,6 +105,20 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 弹幕开关状态监听
|
||||||
|
void danmakuStatusListen() {
|
||||||
|
playerController.isOpenDanmu.listen((p0) {
|
||||||
|
if (p0 && !_plDanmakuController.initiated) {
|
||||||
|
_plDanmakuController.initiate(
|
||||||
|
playerController.duration.value.inMilliseconds,
|
||||||
|
playerController.position.value.inMilliseconds);
|
||||||
|
} else {
|
||||||
|
playerController.danmakuController!.pause();
|
||||||
|
playerController.danmakuController!.clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
playerController.removePositionListener(videoPositionListen);
|
playerController.removePositionListener(videoPositionListen);
|
||||||
@ -122,28 +130,23 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
return LayoutBuilder(builder: (context, box) {
|
return LayoutBuilder(builder: (context, box) {
|
||||||
// double initDuration = box.maxWidth / 12;
|
// double initDuration = box.maxWidth / 12;
|
||||||
return Obx(
|
return Obx(
|
||||||
() => AnimatedOpacity(
|
() => DanmakuView(
|
||||||
opacity: playerController.isOpenDanmu.value ? 1 : 0,
|
createdController: (DanmakuController e) async {
|
||||||
duration: const Duration(milliseconds: 100),
|
playerController.danmakuController = _controller = e;
|
||||||
child: DanmakuView(
|
},
|
||||||
createdController: (DanmakuController e) async {
|
option: DanmakuOption(
|
||||||
playerController.danmakuController = _controller = e;
|
fontSize: 15 * fontSizeVal,
|
||||||
},
|
area: showArea,
|
||||||
option: DanmakuOption(
|
opacity: opacityVal,
|
||||||
fontSize: 15 * fontSizeVal,
|
hideTop: blockTypes.contains(5),
|
||||||
area: showArea,
|
hideScroll: blockTypes.contains(2),
|
||||||
opacity: opacityVal,
|
hideBottom: blockTypes.contains(4),
|
||||||
hideTop: blockTypes.contains(5),
|
duration: danmakuDurationVal / playerController.playbackSpeed,
|
||||||
hideScroll: blockTypes.contains(2),
|
strokeWidth: strokeWidth,
|
||||||
hideBottom: blockTypes.contains(4),
|
// initDuration /
|
||||||
duration:
|
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
||||||
danmakuDurationVal / playerController.playbackSpeed,
|
|
||||||
strokeWidth: strokeWidth,
|
|
||||||
// initDuration /
|
|
||||||
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
|
||||||
),
|
|
||||||
statusChanged: (isPlaying) {},
|
|
||||||
),
|
),
|
||||||
|
statusChanged: (isPlaying) {},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -258,24 +258,27 @@ class HistoryItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
videoItem.progress != 0
|
||||||
left: 3,
|
? Positioned(
|
||||||
right: 3,
|
left: 3,
|
||||||
bottom: 0,
|
right: 3,
|
||||||
child: ClipRRect(
|
bottom: 0,
|
||||||
borderRadius: BorderRadius.only(
|
child: ClipRRect(
|
||||||
bottomLeft:
|
borderRadius: BorderRadius.only(
|
||||||
Radius.circular(StyleString.imgRadius.x),
|
bottomLeft: Radius.circular(
|
||||||
bottomRight:
|
StyleString.imgRadius.x),
|
||||||
Radius.circular(StyleString.imgRadius.x),
|
bottomRight: Radius.circular(
|
||||||
),
|
StyleString.imgRadius.x),
|
||||||
child: LinearProgressIndicator(
|
),
|
||||||
value: videoItem.progress == -1
|
child: LinearProgressIndicator(
|
||||||
? 100
|
value: videoItem.progress == -1
|
||||||
: videoItem.progress / videoItem.duration,
|
? 100
|
||||||
),
|
: videoItem.progress /
|
||||||
),
|
videoItem.duration,
|
||||||
)
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
VideoContent(videoItem: videoItem, ctr: ctr)
|
VideoContent(videoItem: videoItem, ctr: ctr)
|
||||||
|
@ -281,8 +281,8 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
Map data = snapshot.data!;
|
Map? data = snapshot.data;
|
||||||
if (data['status']) {
|
if (data != null && data['status']) {
|
||||||
return Obx(
|
return Obx(
|
||||||
() => Stack(
|
() => Stack(
|
||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
@ -302,7 +302,14 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.titleMedium!
|
.titleMedium!
|
||||||
.copyWith(fontWeight: FontWeight.bold),
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: _memberController.memberInfo.value
|
||||||
|
.vip!.nicknameColor !=
|
||||||
|
null
|
||||||
|
? Color(_memberController.memberInfo
|
||||||
|
.value.vip!.nicknameColor!)
|
||||||
|
: null),
|
||||||
)),
|
)),
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
if (_memberController.memberInfo.value.sex == '女')
|
if (_memberController.memberInfo.value.sex == '女')
|
||||||
|
@ -18,45 +18,32 @@ class MemberSeasonsPanel extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
MemberSeasonsList item = data!.seasonsList![index];
|
MemberSeasonsList item = data!.seasonsList![index];
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 12, right: 4),
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
ListTile(
|
||||||
padding: const EdgeInsets.only(bottom: 12, left: 4),
|
onTap: () => Get.toNamed(
|
||||||
child: Row(
|
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}'),
|
||||||
children: [
|
title: Text(
|
||||||
Text(
|
item.meta!.name!,
|
||||||
item.meta!.name!,
|
maxLines: 1,
|
||||||
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: Theme.of(context).textTheme.titleSmall!,
|
style: Theme.of(context).textTheme.titleSmall!,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
dense: true,
|
||||||
PBadge(
|
leading: PBadge(
|
||||||
stack: 'relative',
|
stack: 'relative',
|
||||||
size: 'small',
|
size: 'small',
|
||||||
text: item.meta!.total.toString(),
|
text: item.meta!.total.toString(),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
trailing: const Icon(
|
||||||
SizedBox(
|
Icons.arrow_forward,
|
||||||
width: 35,
|
size: 20,
|
||||||
height: 35,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () => Get.toNamed(
|
|
||||||
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}'),
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
),
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.arrow_forward,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
LayoutBuilder(
|
LayoutBuilder(
|
||||||
builder: (context, boxConstraints) {
|
builder: (context, boxConstraints) {
|
||||||
return GridView.builder(
|
return GridView.builder(
|
||||||
|
@ -46,4 +46,40 @@ class SubController extends GetxController {
|
|||||||
Future onLoad() async {
|
Future onLoad() async {
|
||||||
querySubFolder(type: 'onload');
|
querySubFolder(type: 'onload');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 取消订阅
|
||||||
|
Future<void> cancelSub(SubFolderItemData subFolderItem) async {
|
||||||
|
showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: const Text('确定取消订阅吗?'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await UserHttp.cancelSub(seasonId: subFolderItem.id!);
|
||||||
|
if (res['status']) {
|
||||||
|
subFolderData.value.list!.remove(subFolderItem);
|
||||||
|
subFolderData.update((val) {});
|
||||||
|
SmartDialog.showToast('取消订阅成功');
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: const Text('确定'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,8 @@ class _SubPageState extends State<SubPage> {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return SubItem(
|
return SubItem(
|
||||||
subFolderItem:
|
subFolderItem:
|
||||||
_subController.subFolderData.value.list![index]);
|
_subController.subFolderData.value.list![index],
|
||||||
|
cancelSub: _subController.cancelSub);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -8,7 +8,12 @@ import '../../../models/user/sub_folder.dart';
|
|||||||
|
|
||||||
class SubItem extends StatelessWidget {
|
class SubItem extends StatelessWidget {
|
||||||
final SubFolderItemData subFolderItem;
|
final SubFolderItemData subFolderItem;
|
||||||
const SubItem({super.key, required this.subFolderItem});
|
final Function(SubFolderItemData) cancelSub;
|
||||||
|
const SubItem({
|
||||||
|
super.key,
|
||||||
|
required this.subFolderItem,
|
||||||
|
required this.cancelSub,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -51,7 +56,10 @@ class SubItem extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
VideoContent(subFolderItem: subFolderItem)
|
VideoContent(
|
||||||
|
subFolderItem: subFolderItem,
|
||||||
|
cancelSub: cancelSub,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -64,7 +72,8 @@ class SubItem extends StatelessWidget {
|
|||||||
|
|
||||||
class VideoContent extends StatelessWidget {
|
class VideoContent extends StatelessWidget {
|
||||||
final SubFolderItemData subFolderItem;
|
final SubFolderItemData subFolderItem;
|
||||||
const VideoContent({super.key, required this.subFolderItem});
|
final Function(SubFolderItemData)? cancelSub;
|
||||||
|
const VideoContent({super.key, required this.subFolderItem, this.cancelSub});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -100,6 +109,24 @@ class VideoContent extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 35,
|
||||||
|
width: 35,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () => cancelSub?.call(subFolderItem),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.delete_outline, size: 18),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:expandable/expandable.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.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';
|
||||||
@ -16,7 +17,6 @@ import 'package:pilipala/utils/feed_back.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import '../../../../http/user.dart';
|
import '../../../../http/user.dart';
|
||||||
import '../widgets/expandable_section.dart';
|
|
||||||
import 'widgets/action_item.dart';
|
import 'widgets/action_item.dart';
|
||||||
import 'widgets/fav_panel.dart';
|
import 'widgets/fav_panel.dart';
|
||||||
import 'widgets/intro_detail.dart';
|
import 'widgets/intro_detail.dart';
|
||||||
@ -140,6 +140,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
late bool enableAi;
|
late bool enableAi;
|
||||||
bool isProcessing = false;
|
bool isProcessing = false;
|
||||||
RxBool isExpand = false.obs;
|
RxBool isExpand = false.obs;
|
||||||
|
late ExpandableController _expandableCtr;
|
||||||
|
|
||||||
void Function()? handleState(Future Function() action) {
|
void Function()? handleState(Future Function() action) {
|
||||||
return isProcessing
|
return isProcessing
|
||||||
? null
|
? null
|
||||||
@ -163,6 +165,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
follower = Utils.numFormat(videoIntroController.userStat['follower']);
|
follower = Utils.numFormat(videoIntroController.userStat['follower']);
|
||||||
followStatus = videoIntroController.followStatus;
|
followStatus = videoIntroController.followStatus;
|
||||||
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
||||||
|
_expandableCtr = ExpandableController(initialExpanded: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
@ -216,6 +219,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
showIntroDetail() {
|
showIntroDetail() {
|
||||||
feedBack();
|
feedBack();
|
||||||
isExpand.value = !(isExpand.value);
|
isExpand.value = !(isExpand.value);
|
||||||
|
_expandableCtr.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户主页
|
// 用户主页
|
||||||
@ -239,6 +243,12 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_expandableCtr.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ThemeData t = Theme.of(context);
|
final ThemeData t = Theme.of(context);
|
||||||
@ -256,14 +266,34 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () => showIntroDetail(),
|
onTap: () => showIntroDetail(),
|
||||||
child: Text(
|
child: ExpandablePanel(
|
||||||
widget.videoDetail!.title!,
|
controller: _expandableCtr,
|
||||||
style: const TextStyle(
|
collapsed: Text(
|
||||||
fontSize: 18,
|
widget.videoDetail!.title!,
|
||||||
fontWeight: FontWeight.bold,
|
softWrap: true,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
expanded: Text(
|
||||||
|
widget.videoDetail!.title!,
|
||||||
|
softWrap: true,
|
||||||
|
maxLines: 4,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
theme: const ExpandableThemeData(
|
||||||
|
animationDuration: Duration(milliseconds: 300),
|
||||||
|
scrollAnimationDuration: Duration(milliseconds: 300),
|
||||||
|
crossFadePoint: 0,
|
||||||
|
fadeCurve: Curves.ease,
|
||||||
|
sizeCurve: Curves.linear,
|
||||||
),
|
),
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
@ -328,12 +358,16 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
|
|
||||||
/// 视频简介
|
/// 视频简介
|
||||||
Obx(
|
ExpandablePanel(
|
||||||
() => ExpandedSection(
|
controller: _expandableCtr,
|
||||||
expand: isExpand.value,
|
collapsed: const SizedBox(height: 0),
|
||||||
begin: 0,
|
expanded: IntroDetail(videoDetail: widget.videoDetail!),
|
||||||
end: 1,
|
theme: const ExpandableThemeData(
|
||||||
child: IntroDetail(videoDetail: widget.videoDetail!),
|
animationDuration: Duration(milliseconds: 300),
|
||||||
|
scrollAnimationDuration: Duration(milliseconds: 300),
|
||||||
|
crossFadePoint: 0,
|
||||||
|
fadeCurve: Curves.ease,
|
||||||
|
sizeCurve: Curves.linear,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -525,14 +525,18 @@ InlineSpan buildContent(
|
|||||||
if (jumpUrlKeysList.isNotEmpty) {
|
if (jumpUrlKeysList.isNotEmpty) {
|
||||||
patternStr += '|${jumpUrlKeysList.join('|')}';
|
patternStr += '|${jumpUrlKeysList.join('|')}';
|
||||||
}
|
}
|
||||||
|
RegExp bv23Regex = RegExp(r'https://b23\.tv/[a-zA-Z0-9]{7}');
|
||||||
final RegExp pattern = RegExp(patternStr);
|
final RegExp pattern = RegExp(patternStr);
|
||||||
List<String> matchedStrs = [];
|
List<String> matchedStrs = [];
|
||||||
void addPlainTextSpan(str) {
|
void addPlainTextSpan(str) {
|
||||||
spanChilds.add(TextSpan(
|
spanChilds.add(
|
||||||
|
TextSpan(
|
||||||
text: str,
|
text: str,
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () =>
|
..onTap = () =>
|
||||||
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem)));
|
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分割文本并处理每个部分
|
// 分割文本并处理每个部分
|
||||||
@ -734,8 +738,36 @@ InlineSpan buildContent(
|
|||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
onNonMatch: (String nonMatchStr) {
|
onNonMatch: (String nonMatchStr) {
|
||||||
addPlainTextSpan(nonMatchStr);
|
return nonMatchStr.splitMapJoin(
|
||||||
return nonMatchStr;
|
bv23Regex,
|
||||||
|
onMatch: (Match match) {
|
||||||
|
String matchStr = match[0]!;
|
||||||
|
spanChilds.add(
|
||||||
|
TextSpan(
|
||||||
|
text: ' $matchStr ',
|
||||||
|
style: isVideoPage
|
||||||
|
? TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () => Get.toNamed(
|
||||||
|
'/webview',
|
||||||
|
parameters: {
|
||||||
|
'url': matchStr,
|
||||||
|
'type': 'url',
|
||||||
|
'pageTitle': matchStr
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
onNonMatch: (String nonMatchOtherStr) {
|
||||||
|
addPlainTextSpan(nonMatchOtherStr);
|
||||||
|
return nonMatchOtherStr;
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,9 +142,10 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double keyboardHeight = EdgeInsets.fromViewPadding(
|
double _keyboardHeight = EdgeInsets.fromViewPadding(
|
||||||
View.of(context).viewInsets, View.of(context).devicePixelRatio)
|
View.of(context).viewInsets, View.of(context).devicePixelRatio)
|
||||||
.bottom;
|
.bottom;
|
||||||
|
print('_keyboardHeight: $_keyboardHeight');
|
||||||
return Container(
|
return Container(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -235,7 +236,11 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: toolbarType == 'input' ? keyboardHeight : emoteHeight,
|
height: toolbarType == 'input'
|
||||||
|
? (_keyboardHeight > keyboardHeight
|
||||||
|
? _keyboardHeight
|
||||||
|
: keyboardHeight)
|
||||||
|
: emoteHeight,
|
||||||
child: EmotePanel(
|
child: EmotePanel(
|
||||||
onChoose: (package, emote) => onChooseEmote(package, emote),
|
onChoose: (package, emote) => onChooseEmote(package, emote),
|
||||||
),
|
),
|
||||||
|
@ -17,6 +17,7 @@ import 'package:pilipala/plugin/pl_player/index.dart';
|
|||||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/services/shutdown_timer_service.dart';
|
import 'package:pilipala/services/shutdown_timer_service.dart';
|
||||||
|
import '../../../../http/danmaku.dart';
|
||||||
import '../../../../models/common/search_type.dart';
|
import '../../../../models/common/search_type.dart';
|
||||||
import '../../../../models/video_detail_res.dart';
|
import '../../../../models/video_detail_res.dart';
|
||||||
import '../introduction/index.dart';
|
import '../introduction/index.dart';
|
||||||
@ -52,7 +53,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
final Box<dynamic> videoStorage = GStrorage.video;
|
final Box<dynamic> videoStorage = GStrorage.video;
|
||||||
late List<double> speedsList;
|
late List<double> speedsList;
|
||||||
double buttonSpace = 8;
|
double buttonSpace = 8;
|
||||||
bool showTitle = false;
|
RxBool isFullScreen = false.obs;
|
||||||
late String heroTag;
|
late String heroTag;
|
||||||
late VideoIntroController videoIntroController;
|
late VideoIntroController videoIntroController;
|
||||||
late VideoDetailData videoDetail;
|
late VideoDetailData videoDetail;
|
||||||
@ -69,13 +70,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fullScreenStatusListener() {
|
void fullScreenStatusListener() {
|
||||||
widget.videoDetailCtr!.plPlayerController.isFullScreen
|
widget.videoDetailCtr!.plPlayerController.isFullScreen.listen((bool val) {
|
||||||
.listen((bool isFullScreen) {
|
isFullScreen.value = val;
|
||||||
if (isFullScreen) {
|
|
||||||
showTitle = true;
|
|
||||||
} else {
|
|
||||||
showTitle = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// TODO setState() called after dispose()
|
/// TODO setState() called after dispose()
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@ -218,6 +214,87 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 发送弹幕
|
||||||
|
void showShootDanmakuSheet() {
|
||||||
|
final TextEditingController textController = TextEditingController();
|
||||||
|
bool isSending = false; // 追踪是否正在发送
|
||||||
|
showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
// TODO: 支持更多类型和颜色的弹幕
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('发送弹幕(测试)'),
|
||||||
|
content: StatefulBuilder(
|
||||||
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
return TextField(
|
||||||
|
controller: textController,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Get.back(),
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
StatefulBuilder(
|
||||||
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
return TextButton(
|
||||||
|
onPressed: isSending
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
|
final String msg = textController.text;
|
||||||
|
if (msg.isEmpty) {
|
||||||
|
SmartDialog.showToast('弹幕内容不能为空');
|
||||||
|
return;
|
||||||
|
} else if (msg.length > 100) {
|
||||||
|
SmartDialog.showToast('弹幕内容不能超过100个字符');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
isSending = true; // 开始发送,更新状态
|
||||||
|
});
|
||||||
|
//修改按钮文字
|
||||||
|
final dynamic res = await DanmakaHttp.shootDanmaku(
|
||||||
|
oid: widget.videoDetailCtr!.cid.value,
|
||||||
|
msg: textController.text,
|
||||||
|
bvid: widget.videoDetailCtr!.bvid,
|
||||||
|
progress:
|
||||||
|
widget.controller!.position.value.inMilliseconds,
|
||||||
|
type: 1,
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isSending = false; // 发送结束,更新状态
|
||||||
|
});
|
||||||
|
if (res['status']) {
|
||||||
|
SmartDialog.showToast('发送成功');
|
||||||
|
// 发送成功,自动预览该弹幕,避免重新请求
|
||||||
|
// TODO: 暂停状态下预览弹幕仍会移动与计时,可考虑添加到dmSegList或其他方式实现
|
||||||
|
widget.controller!.danmakuController!.addItems([
|
||||||
|
DanmakuItem(
|
||||||
|
msg,
|
||||||
|
color: Colors.white,
|
||||||
|
time: widget
|
||||||
|
.controller!.position.value.inMilliseconds,
|
||||||
|
type: DanmakuItemType.scroll,
|
||||||
|
isSend: true,
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
Get.back();
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast('发送失败,错误信息为${res['msg']}');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(isSending ? '发送中...' : '发送'),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// 定时关闭
|
/// 定时关闭
|
||||||
void scheduleExit() async {
|
void scheduleExit() async {
|
||||||
const List<int> scheduleTimeChoices = [
|
const List<int> scheduleTimeChoices = [
|
||||||
@ -1079,7 +1156,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
if (showTitle &&
|
if (isFullScreen.value &&
|
||||||
isLandscape &&
|
isLandscape &&
|
||||||
widget.videoType == SearchType.video) ...[
|
widget.videoType == SearchType.video) ...[
|
||||||
Column(
|
Column(
|
||||||
@ -1131,6 +1208,43 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
// ),
|
// ),
|
||||||
// fuc: () => _.screenshot(),
|
// fuc: () => _.screenshot(),
|
||||||
// ),
|
// ),
|
||||||
|
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,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
if (Platform.isAndroid) ...<Widget>[
|
if (Platform.isAndroid) ...<Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
@ -51,7 +51,7 @@ class Utils {
|
|||||||
}
|
}
|
||||||
if (time < 3600) {
|
if (time < 3600) {
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
return time;
|
return '00:00';
|
||||||
}
|
}
|
||||||
final int minute = time ~/ 60;
|
final int minute = time ~/ 60;
|
||||||
final double res = time / 60;
|
final double res = time / 60;
|
||||||
@ -208,14 +208,16 @@ class Utils {
|
|||||||
|
|
||||||
static int findClosestNumber(int target, List<int> numbers) {
|
static int findClosestNumber(int target, List<int> numbers) {
|
||||||
int minDiff = 127;
|
int minDiff = 127;
|
||||||
late int closestNumber;
|
int closestNumber = 0; // 初始化为0,表示没有找到比目标值小的整数
|
||||||
try {
|
try {
|
||||||
for (int number in numbers) {
|
for (int number in numbers) {
|
||||||
int diff = (number - target).abs();
|
if (number < target) {
|
||||||
|
int diff = target - number; // 计算目标值与当前整数的差值
|
||||||
|
|
||||||
if (diff < minDiff) {
|
if (diff < minDiff) {
|
||||||
minDiff = diff;
|
minDiff = diff;
|
||||||
closestNumber = number;
|
closestNumber = number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
@ -433,6 +433,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.3"
|
version: "5.0.3"
|
||||||
|
expandable:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: expandable
|
||||||
|
sha256: "9604d612d4d1146dafa96c6d8eec9c2ff0994658d6d09fed720ab788c7f5afc2"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.1"
|
||||||
extended_image:
|
extended_image:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -142,6 +142,8 @@ dependencies:
|
|||||||
path: 1.8.3
|
path: 1.8.3
|
||||||
# 电池优化
|
# 电池优化
|
||||||
disable_battery_optimization: ^1.1.1
|
disable_battery_optimization: ^1.1.1
|
||||||
|
# 展开/收起
|
||||||
|
expandable: ^5.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user