Compare commits
1 Commits
fix-bangum
...
feature-se
Author | SHA1 | Date | |
---|---|---|---|
bc26e79bf9 |
@ -490,6 +490,9 @@ class Api {
|
||||
/// 我的订阅详情
|
||||
static const userSubFolderDetail = '/x/space/fav/season/list';
|
||||
|
||||
/// 取消订阅
|
||||
static const userSubCancel = '/x/v3/fav/season/unfav';
|
||||
|
||||
/// 表情
|
||||
static const emojiList = '/x/emote/user/panel/web';
|
||||
|
||||
|
@ -349,4 +349,21 @@ class UserHttp {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 取消订阅
|
||||
static Future userSubCancel({required int seasonId}) async {
|
||||
var res = await Request().post(
|
||||
Api.userSubCancel,
|
||||
queryParameters: {
|
||||
'season_id': seasonId,
|
||||
'platform': 'web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': '取消订阅成功'};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
vsync: this,
|
||||
);
|
||||
// 监听 tabController 切换
|
||||
if (enableGradientBg) {
|
||||
tabController.animation!.addListener(() {
|
||||
if (tabController.indexIsChanging) {
|
||||
if (initialIndex.value != tabController.index) {
|
||||
@ -106,7 +105,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void searchDefault() async {
|
||||
var res = await Request().get(Api.searchDefault);
|
||||
|
@ -46,4 +46,41 @@ class SubController extends GetxController {
|
||||
Future onLoad() async {
|
||||
querySubFolder(type: 'onload');
|
||||
}
|
||||
|
||||
// 取消订阅
|
||||
Future<dynamic> cancelSub({required int id}) async {
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return 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 {
|
||||
Get.back();
|
||||
var res = await UserHttp.userSubCancel(seasonId: id);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('取消订阅成功');
|
||||
subFolderData.value.list!
|
||||
.removeWhere((element) => element.id == id);
|
||||
subFolderData.update((val) {});
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,14 @@ class _SubPageState extends State<SubPage> {
|
||||
itemBuilder: (context, index) {
|
||||
return SubItem(
|
||||
subFolderItem:
|
||||
_subController.subFolderData.value.list![index]);
|
||||
_subController.subFolderData.value.list![index],
|
||||
fuc: () {
|
||||
_subController.cancelSub(
|
||||
id: _subController
|
||||
.subFolderData.value.list![index].id!,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -8,7 +8,8 @@ import '../../../models/user/sub_folder.dart';
|
||||
|
||||
class SubItem extends StatelessWidget {
|
||||
final SubFolderItemData subFolderItem;
|
||||
const SubItem({super.key, required this.subFolderItem});
|
||||
final Function fuc;
|
||||
const SubItem({super.key, required this.subFolderItem, required this.fuc});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -51,7 +52,7 @@ class SubItem extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
VideoContent(subFolderItem: subFolderItem)
|
||||
VideoContent(subFolderItem: subFolderItem, fuc: fuc)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -64,7 +65,9 @@ class SubItem extends StatelessWidget {
|
||||
|
||||
class VideoContent extends StatelessWidget {
|
||||
final SubFolderItemData subFolderItem;
|
||||
const VideoContent({super.key, required this.subFolderItem});
|
||||
final Function fuc;
|
||||
const VideoContent(
|
||||
{super.key, required this.subFolderItem, required this.fuc});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -100,6 +103,20 @@ class VideoContent extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
height: 34,
|
||||
child: TextButton(
|
||||
onPressed: () => fuc(),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.onInverseSurface, // 设置按钮背景色
|
||||
),
|
||||
child: const Text('取消订阅'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -129,7 +129,6 @@ class VideoDetailController extends GetxController
|
||||
videoDetailCtr: this,
|
||||
floating: floating,
|
||||
bvid: bvid,
|
||||
videoType: videoType,
|
||||
);
|
||||
// CDN优化
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
|
@ -572,7 +572,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
controller: plPlayerController,
|
||||
videoDetailCtr: videoDetailController,
|
||||
bvid: videoDetailController.bvid,
|
||||
videoType: videoDetailController.videoType,
|
||||
),
|
||||
danmuWidget: Obx(
|
||||
() => PlDanmaku(
|
||||
|
@ -19,7 +19,6 @@ import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/http/danmaku.dart';
|
||||
import 'package:pilipala/services/shutdown_timer_service.dart';
|
||||
import '../../../../models/common/search_type.dart';
|
||||
import '../../../../models/video_detail_res.dart';
|
||||
import '../introduction/index.dart';
|
||||
|
||||
@ -29,14 +28,12 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||
this.videoDetailCtr,
|
||||
this.floating,
|
||||
this.bvid,
|
||||
this.videoType,
|
||||
super.key,
|
||||
});
|
||||
final PlPlayerController? controller;
|
||||
final VideoDetailController? videoDetailCtr;
|
||||
final Floating? floating;
|
||||
final String? bvid;
|
||||
final SearchType? videoType;
|
||||
|
||||
@override
|
||||
State<HeaderControl> createState() => _HeaderControlState();
|
||||
@ -1110,16 +1107,14 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
},
|
||||
),
|
||||
SizedBox(width: buttonSpace),
|
||||
if (showTitle &&
|
||||
isLandscape &&
|
||||
widget.videoType == SearchType.video) ...[
|
||||
if (showTitle && isLandscape) ...[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 200),
|
||||
constraints: BoxConstraints(maxWidth: 200),
|
||||
child: Text(
|
||||
videoIntroController.videoDetail.value.title ?? '',
|
||||
videoIntroController.videoDetail.value.title!,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
|
Reference in New Issue
Block a user