Compare commits
1 Commits
feature-su
...
feature-ad
Author | SHA1 | Date | |
---|---|---|---|
296f4108b8 |
@ -506,6 +506,4 @@ class Api {
|
||||
/// 排行榜
|
||||
static const String getRankApi = "/x/web-interface/ranking/v2";
|
||||
|
||||
/// 取消订阅
|
||||
static const String cancelSub = '/x/v3/fav/season/unfav';
|
||||
}
|
||||
|
@ -349,21 +349,4 @@ class UserHttp {
|
||||
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']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,8 +437,7 @@ class SearchArticleItemModel {
|
||||
pubTime = json['pub_time'];
|
||||
like = json['like'];
|
||||
title = Em.regTitle(json['title']);
|
||||
subTitle =
|
||||
Em.decodeHtmlEntities(json['title'].replaceAll(RegExp(r'<[^>]*>'), ''));
|
||||
subTitle = json['title'].replaceAll(RegExp(r'<[^>]*>'), '');
|
||||
rankOffset = json['rank_offset'];
|
||||
mid = json['mid'];
|
||||
imageUrls = json['image_urls'];
|
||||
|
@ -185,7 +185,7 @@ class HistoryItem extends StatelessWidget {
|
||||
? '已看完'
|
||||
: '${Utils.timeFormat(videoItem.progress!)}/${Utils.timeFormat(videoItem.duration!)}',
|
||||
right: 6.0,
|
||||
bottom: 8.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
),
|
||||
// 右上角
|
||||
@ -258,24 +258,6 @@ class HistoryItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 3,
|
||||
right: 3,
|
||||
bottom: 0,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft:
|
||||
Radius.circular(StyleString.imgRadius.x),
|
||||
bottomRight:
|
||||
Radius.circular(StyleString.imgRadius.x),
|
||||
),
|
||||
child: LinearProgressIndicator(
|
||||
value: videoItem.progress == -1
|
||||
? 100
|
||||
: videoItem.progress / videoItem.duration,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
VideoContent(videoItem: videoItem, ctr: ctr)
|
||||
|
@ -46,40 +46,4 @@ class SubController extends GetxController {
|
||||
Future onLoad() async {
|
||||
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,8 +58,7 @@ class _SubPageState extends State<SubPage> {
|
||||
itemBuilder: (context, index) {
|
||||
return SubItem(
|
||||
subFolderItem:
|
||||
_subController.subFolderData.value.list![index],
|
||||
cancelSub: _subController.cancelSub);
|
||||
_subController.subFolderData.value.list![index]);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -8,12 +8,7 @@ import '../../../models/user/sub_folder.dart';
|
||||
|
||||
class SubItem extends StatelessWidget {
|
||||
final SubFolderItemData subFolderItem;
|
||||
final Function(SubFolderItemData) cancelSub;
|
||||
const SubItem({
|
||||
super.key,
|
||||
required this.subFolderItem,
|
||||
required this.cancelSub,
|
||||
});
|
||||
const SubItem({super.key, required this.subFolderItem});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -56,10 +51,7 @@ class SubItem extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
VideoContent(
|
||||
subFolderItem: subFolderItem,
|
||||
cancelSub: cancelSub,
|
||||
)
|
||||
VideoContent(subFolderItem: subFolderItem)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -72,8 +64,7 @@ class SubItem extends StatelessWidget {
|
||||
|
||||
class VideoContent extends StatelessWidget {
|
||||
final SubFolderItemData subFolderItem;
|
||||
final Function(SubFolderItemData)? cancelSub;
|
||||
const VideoContent({super.key, required this.subFolderItem, this.cancelSub});
|
||||
const VideoContent({super.key, required this.subFolderItem});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -109,24 +100,6 @@ class VideoContent extends StatelessWidget {
|
||||
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,4 +1,3 @@
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -17,6 +16,7 @@ import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import '../../../../http/user.dart';
|
||||
import '../widgets/expandable_section.dart';
|
||||
import 'widgets/action_item.dart';
|
||||
import 'widgets/fav_panel.dart';
|
||||
import 'widgets/intro_detail.dart';
|
||||
@ -140,8 +140,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
late bool enableAi;
|
||||
bool isProcessing = false;
|
||||
RxBool isExpand = false.obs;
|
||||
late ExpandableController _expandableCtr;
|
||||
|
||||
void Function()? handleState(Future Function() action) {
|
||||
return isProcessing
|
||||
? null
|
||||
@ -165,7 +163,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
follower = Utils.numFormat(videoIntroController.userStat['follower']);
|
||||
followStatus = videoIntroController.followStatus;
|
||||
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
||||
_expandableCtr = ExpandableController(initialExpanded: false);
|
||||
}
|
||||
|
||||
// 收藏
|
||||
@ -219,7 +216,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
showIntroDetail() {
|
||||
feedBack();
|
||||
isExpand.value = !(isExpand.value);
|
||||
_expandableCtr.toggle();
|
||||
}
|
||||
|
||||
// 用户主页
|
||||
@ -243,12 +239,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_expandableCtr.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData t = Theme.of(context);
|
||||
@ -266,34 +256,14 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () => showIntroDetail(),
|
||||
child: ExpandablePanel(
|
||||
controller: _expandableCtr,
|
||||
collapsed: Text(
|
||||
widget.videoDetail!.title!,
|
||||
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,
|
||||
child: Text(
|
||||
widget.videoDetail!.title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Stack(
|
||||
@ -358,16 +328,12 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
),
|
||||
|
||||
/// 视频简介
|
||||
ExpandablePanel(
|
||||
controller: _expandableCtr,
|
||||
collapsed: const SizedBox(height: 0),
|
||||
expanded: IntroDetail(videoDetail: widget.videoDetail!),
|
||||
theme: const ExpandableThemeData(
|
||||
animationDuration: Duration(milliseconds: 300),
|
||||
scrollAnimationDuration: Duration(milliseconds: 300),
|
||||
crossFadePoint: 0,
|
||||
fadeCurve: Curves.ease,
|
||||
sizeCurve: Curves.linear,
|
||||
Obx(
|
||||
() => ExpandedSection(
|
||||
expand: isExpand.value,
|
||||
begin: 0,
|
||||
end: 1,
|
||||
child: IntroDetail(videoDetail: widget.videoDetail!),
|
||||
),
|
||||
),
|
||||
|
||||
|
@ -149,16 +149,13 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
delegate: _MySliverPersistentHeaderDelegate(
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 6, 0),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.fromLTRB(12, 6, 6, 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Obx(
|
||||
() => Text(
|
||||
'${_videoReplyController.sortTypeLabel.value}评论',
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
Text(
|
||||
'${_videoReplyController.sortTypeLabel.value}评论',
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
SizedBox(
|
||||
height: 35,
|
||||
|
@ -19,7 +19,15 @@ class Em {
|
||||
return regCate(matchStr);
|
||||
}, onNonMatch: (String str) {
|
||||
if (str != '') {
|
||||
str = decodeHtmlEntities(str);
|
||||
str = str
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll(' ', " ")
|
||||
.replaceAll('&', "&");
|
||||
Map map = {'type': 'text', 'text': str};
|
||||
res.add(map);
|
||||
}
|
||||
@ -27,17 +35,4 @@ class Em {
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
static String decodeHtmlEntities(String title) {
|
||||
return title
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll(' ', " ")
|
||||
.replaceAll('&', "&")
|
||||
.replaceAll(''', "'");
|
||||
}
|
||||
}
|
||||
|
@ -433,14 +433,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -142,8 +142,6 @@ dependencies:
|
||||
path: 1.8.3
|
||||
# 电池优化
|
||||
disable_battery_optimization: ^1.1.1
|
||||
# 展开/收起
|
||||
expandable: ^5.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user