mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refa: opus (#762)
* feat: opus * fix * fix * fix * fix * . * fix * remove * wbi sign * fix * opus content null check Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
3722ff1f33
commit
bd3c76ef43
@@ -4,6 +4,7 @@ import 'package:PiliPlus/common/widgets/avatar.dart';
|
||||
import 'package:PiliPlus/common/widgets/report.dart';
|
||||
import 'package:PiliPlus/common/widgets/save_panel.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
@@ -20,7 +21,7 @@ import '../../../http/constants.dart';
|
||||
import '../controller.dart';
|
||||
|
||||
class AuthorPanel extends StatelessWidget {
|
||||
final dynamic item;
|
||||
final DynamicItemModel item;
|
||||
final Function? addBannedList;
|
||||
final String? source;
|
||||
final Function? onRemove;
|
||||
@@ -40,7 +41,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
Widget _buildAvatar() {
|
||||
String? pendant = item.modules.moduleAuthor?.pendant?['image'];
|
||||
Widget avatar = Avatar(
|
||||
avatar: item.modules.moduleAuthor.face,
|
||||
avatar: item.modules.moduleAuthor?.face ?? '',
|
||||
size: pendant.isNullOrEmpty ? 40 : 34,
|
||||
isVip: null, // item.modules.moduleAuthor!.vip['status'] > 0
|
||||
officialType: null, // 已被注释
|
||||
@@ -55,14 +56,14 @@ class AuthorPanel extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
String? pubTime = item.modules.moduleAuthor.pubTs != null
|
||||
final pubTime = item.modules.moduleAuthor?.pubTs != null
|
||||
? isSave
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
item.modules.moduleAuthor.pubTs * 1000)
|
||||
item.modules.moduleAuthor!.pubTs! * 1000)
|
||||
.toString()
|
||||
.substring(0, 19)
|
||||
: Utils.dateFormat(item.modules.moduleAuthor.pubTs)
|
||||
: item.modules.moduleAuthor.pubTime;
|
||||
: Utils.dateFormat(item.modules.moduleAuthor!.pubTs)
|
||||
: item.modules.moduleAuthor?.pubTime;
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
@@ -71,17 +72,17 @@ class AuthorPanel extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
(item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' ||
|
||||
item.modules.moduleAuthor.type ==
|
||||
(item.modules.moduleAuthor!.type == 'AUTHOR_TYPE_PGC' ||
|
||||
item.modules.moduleAuthor!.type ==
|
||||
'AUTHOR_TYPE_UGC_SEASON')
|
||||
? _buildAvatar() // 番剧
|
||||
: GestureDetector(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
Get.toNamed(
|
||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||
'/member?mid=${item.modules.moduleAuthor!.mid}',
|
||||
arguments: {
|
||||
'face': item.modules.moduleAuthor.face,
|
||||
'face': item.modules.moduleAuthor!.face,
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -92,11 +93,11 @@ class AuthorPanel extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.modules.moduleAuthor.name,
|
||||
item.modules.moduleAuthor?.name ?? '',
|
||||
style: TextStyle(
|
||||
color: item.modules.moduleAuthor!.vip != null &&
|
||||
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
||||
item.modules.moduleAuthor!.vip['type'] == 2
|
||||
item.modules.moduleAuthor!.vip!['status'] > 0 &&
|
||||
item.modules.moduleAuthor!.vip!['type'] == 2
|
||||
? context.vipColor
|
||||
: theme.colorScheme.onSurface,
|
||||
fontSize: theme.textTheme.titleSmall!.fontSize,
|
||||
@@ -104,7 +105,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
if (pubTime != null)
|
||||
Text(
|
||||
'$pubTime${item.modules.moduleAuthor.pubAction != null ? ' ${item.modules.moduleAuthor.pubAction}' : ''}',
|
||||
'$pubTime${item.modules.moduleAuthor?.pubAction != null ? ' ${item.modules.moduleAuthor!.pubAction}' : ''}',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
@@ -117,7 +118,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: source != 'detail' && item.modules?.moduleTag?.text != null
|
||||
child: source != 'detail' && item.modules.moduleTag?.text != null
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -133,7 +134,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
item.modules.moduleTag.text,
|
||||
item.modules.moduleTag!.text!,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 12,
|
||||
@@ -149,7 +150,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
_moreWidget(context),
|
||||
],
|
||||
)
|
||||
: item.modules.moduleAuthor.decorate != null
|
||||
: item.modules.moduleAuthor!.decorate != null
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -159,31 +160,31 @@ class AuthorPanel extends StatelessWidget {
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
height: 32,
|
||||
imageUrl: (item.modules.moduleAuthor
|
||||
.decorate['card_url'] as String)
|
||||
imageUrl: (item.modules.moduleAuthor!
|
||||
.decorate!['card_url'] as String)
|
||||
.http2https,
|
||||
),
|
||||
if ((item.modules.moduleAuthor.decorate?['fan']
|
||||
if ((item.modules.moduleAuthor?.decorate?['fan']
|
||||
?['num_str'] as String?)
|
||||
?.isNotEmpty ==
|
||||
true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 32),
|
||||
child: Text(
|
||||
'${item.modules.moduleAuthor.decorate['fan']['num_str']}',
|
||||
'${item.modules.moduleAuthor!.decorate!['fan']['num_str']}',
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 11,
|
||||
fontFamily: 'digital_id_num',
|
||||
color: (item.modules.moduleAuthor
|
||||
.decorate?['fan']
|
||||
?['color'] as String?)
|
||||
color: (item.modules.moduleAuthor!
|
||||
.decorate!['fan']
|
||||
['color'] as String?)
|
||||
?.startsWith('#') ==
|
||||
true
|
||||
? Color(
|
||||
int.parse(
|
||||
item.modules.moduleAuthor
|
||||
.decorate['fan']['color']
|
||||
item.modules.moduleAuthor!
|
||||
.decorate!['fan']['color']
|
||||
.replaceFirst('#', '0xFF'),
|
||||
),
|
||||
)
|
||||
@@ -220,15 +221,15 @@ class AuthorPanel extends StatelessWidget {
|
||||
void morePanel(BuildContext context) {
|
||||
String? bvid;
|
||||
try {
|
||||
getBvid(String? type, dynamic major) => switch (type) {
|
||||
getBvid(String? type, DynamicMajorModel? major) => switch (type) {
|
||||
'DYNAMIC_TYPE_AV' => major?.archive?.bvid,
|
||||
'DYNAMIC_TYPE_UGC_SEASON' => major?.ugcSeason?.bvid,
|
||||
_ => null,
|
||||
};
|
||||
bvid = getBvid(item.type, item.modules?.moduleDynamic?.major);
|
||||
bvid = getBvid(item.type, item.modules.moduleDynamic?.major);
|
||||
if (bvid == null && item.orig != null) {
|
||||
bvid =
|
||||
getBvid(item.orig.type, item.orig?.modules?.moduleDynamic?.major);
|
||||
getBvid(item.orig!.type, item.orig?.modules.moduleDynamic?.major);
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
@@ -308,8 +309,8 @@ class AuthorPanel extends StatelessWidget {
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
if (item.basic['comment_type'] == 17 ||
|
||||
item.basic['comment_type'] == 11)
|
||||
if (item.basic!.commentType == 17 ||
|
||||
item.basic!.commentType == 11)
|
||||
ListTile(
|
||||
title: Text(
|
||||
'分享至消息',
|
||||
@@ -319,23 +320,23 @@ class AuthorPanel extends StatelessWidget {
|
||||
onTap: () {
|
||||
Get.back();
|
||||
try {
|
||||
bool isDyn = item.basic['comment_type'] == 17;
|
||||
String id = isDyn ? item.idStr : item.basic['rid_str'];
|
||||
bool isDyn = item.basic!.commentType == 17;
|
||||
String id = isDyn ? item.idStr : item.basic!.ridStr!;
|
||||
int source = isDyn ? 11 : 2;
|
||||
String title;
|
||||
if (item.modules.moduleDynamic.desc != null) {
|
||||
title = item.modules.moduleDynamic.desc.text;
|
||||
} else if (item.modules.moduleDynamic.major != null) {
|
||||
title =
|
||||
item.modules.moduleDynamic.major.opus.summary.text;
|
||||
if (item.modules.moduleDynamic?.desc != null) {
|
||||
title = item.modules.moduleDynamic!.desc!.text!;
|
||||
} else if (item.modules.moduleDynamic?.major != null) {
|
||||
title = item
|
||||
.modules.moduleDynamic!.major!.opus!.summary!.text!;
|
||||
} else {
|
||||
throw UnsupportedError(
|
||||
'error getting title: {"type": ${item.basic['comment_type']}, "id": $id}');
|
||||
'error getting title: {"type": ${item.basic!.commentType}, "id": $id}');
|
||||
}
|
||||
String thumb = isDyn
|
||||
? item.modules.moduleAuthor.face
|
||||
: item
|
||||
.modules.moduleDynamic.major.opus.pics.first.url;
|
||||
? item.modules.moduleAuthor!.face!
|
||||
: item.modules.moduleDynamic!.major!.opus!.pics!.first
|
||||
.url!;
|
||||
PageUtils.pmShare(
|
||||
content: {
|
||||
"id": id,
|
||||
@@ -344,8 +345,8 @@ class AuthorPanel extends StatelessWidget {
|
||||
"source": source,
|
||||
"extra": {},
|
||||
"thumb": thumb,
|
||||
"author": item.modules.moduleAuthor.name,
|
||||
"author_id": item.modules.moduleAuthor.mid.toString()
|
||||
"author": item.modules.moduleAuthor!.name,
|
||||
"author_id": item.modules.moduleAuthor!.mid.toString()
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
@@ -356,7 +357,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'临时屏蔽:${item.modules?.moduleAuthor?.name}',
|
||||
'临时屏蔽:${item.modules.moduleAuthor?.name}',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
leading: const Icon(Icons.visibility_off_outlined, size: 19),
|
||||
@@ -364,13 +365,13 @@ class AuthorPanel extends StatelessWidget {
|
||||
Get.back();
|
||||
Get.find<DynamicsController>()
|
||||
.tempBannedList
|
||||
.add(item.modules.moduleAuthor.mid);
|
||||
.add(item.modules.moduleAuthor!.mid!);
|
||||
SmartDialog.showToast(
|
||||
'已临时屏蔽${item.modules?.moduleAuthor?.name}(${item.modules.moduleAuthor.mid}),重启恢复');
|
||||
'已临时屏蔽${item.modules.moduleAuthor?.name}(${item.modules.moduleAuthor!.mid}),重启恢复');
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
if (item.modules?.moduleAuthor?.mid == Accounts.main.mid) ...[
|
||||
if (item.modules.moduleAuthor?.mid == Accounts.main.mid) ...[
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
@@ -393,12 +394,12 @@ class AuthorPanel extends StatelessWidget {
|
||||
onTap: () {
|
||||
Get.back();
|
||||
onSetTop!(
|
||||
item.modules?.moduleTag?.text != null, item.idStr);
|
||||
item.modules.moduleTag?.text != null, item.idStr);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.vertical_align_top, size: 19),
|
||||
title: Text(
|
||||
'${item.modules?.moduleTag?.text != null ? '取消' : ''}置顶',
|
||||
'${item.modules.moduleTag?.text != null ? '取消' : ''}置顶',
|
||||
style: Theme.of(context).textTheme.titleSmall!),
|
||||
),
|
||||
if (onRemove != null)
|
||||
@@ -459,13 +460,13 @@ class AuthorPanel extends StatelessWidget {
|
||||
(reasonType, reasonDesc, banUid) {
|
||||
if (banUid) {
|
||||
VideoHttp.relationMod(
|
||||
mid: item.modules!.moduleAuthor!.mid!,
|
||||
mid: item.modules.moduleAuthor!.mid!,
|
||||
act: 5,
|
||||
reSrc: 11,
|
||||
);
|
||||
}
|
||||
return UserHttp.dynamicReport(
|
||||
mid: item.modules!.moduleAuthor!.mid,
|
||||
mid: item.modules.moduleAuthor!.mid,
|
||||
dynId: item.idStr,
|
||||
reasonType: reasonType,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user