mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-21 16:48:43 +00: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
@@ -2,7 +2,6 @@ import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/reply_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/opus_detail/data.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/common/reply_controller.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
@@ -31,7 +30,7 @@ class DynamicDetailController extends ReplyController<MainListReply> {
|
||||
item = Get.arguments['item'];
|
||||
floor = Get.arguments['floor'];
|
||||
if (floor == 1) {
|
||||
count.value = int.parse(item.modules!.moduleStat!.comment!.count ?? '0');
|
||||
count.value = item.modules.moduleStat?.comment?.count ?? 0;
|
||||
}
|
||||
|
||||
if (oid != 0) {
|
||||
@@ -41,10 +40,10 @@ class DynamicDetailController extends ReplyController<MainListReply> {
|
||||
|
||||
getCommentParams(int id) async {
|
||||
var res = await DynamicsHttp.opusDetail(opusId: id);
|
||||
if (res['status']) {
|
||||
OpusData data = res['data'];
|
||||
type = data.item!.basic!.commentType!;
|
||||
oid = int.parse(data.item!.basic!.commentIdStr!);
|
||||
if (res is Success) {
|
||||
final data = (res as Success<DynamicItemModel>).response;
|
||||
type = data.basic!.commentType!;
|
||||
oid = int.parse(data.basic!.commentIdStr!);
|
||||
queryData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,14 +118,15 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
// 楼层
|
||||
int floor = args['floor'];
|
||||
// 评论类型
|
||||
int commentType = args['item'].basic!['comment_type'] ?? 11;
|
||||
final item = args['item'] as DynamicItemModel;
|
||||
int commentType = item.basic?.commentType ?? 11;
|
||||
replyType = (commentType == 0) ? 11 : commentType;
|
||||
|
||||
if (floor == 1) {
|
||||
oid = int.parse(args['item'].basic!['comment_id_str']);
|
||||
oid = int.parse(item.basic!.commentIdStr!);
|
||||
} else {
|
||||
try {
|
||||
ModuleDynamicModel moduleDynamic = args['item'].modules.moduleDynamic;
|
||||
final moduleDynamic = item.modules.moduleDynamic!;
|
||||
String majorType = moduleDynamic.major!.type!;
|
||||
|
||||
if (majorType == 'MAJOR_TYPE_OPUS') {
|
||||
@@ -528,32 +529,31 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
item: _dynamicDetailController
|
||||
.item,
|
||||
callback: () {
|
||||
int count = int.tryParse(
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
?.forward
|
||||
?.count ??
|
||||
'0') ??
|
||||
0;
|
||||
int count =
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
.moduleStat
|
||||
?.forward
|
||||
?.count ??
|
||||
0;
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat ??=
|
||||
.moduleStat ??=
|
||||
ModuleStatModel();
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules!
|
||||
.moduleStat
|
||||
?.forward ??= ForWard();
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules!
|
||||
.moduleStat!
|
||||
.forward!
|
||||
.count =
|
||||
(count + 1).toString();
|
||||
.modules
|
||||
.moduleStat
|
||||
?.forward ??=
|
||||
DynamicStat();
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
.moduleStat!
|
||||
.forward!
|
||||
.count = count + 1;
|
||||
if (btnContext.mounted) {
|
||||
(btnContext as Element?)
|
||||
?.markNeedsBuild();
|
||||
@@ -581,14 +581,14 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
.moduleStat
|
||||
?.forward
|
||||
?.count !=
|
||||
null
|
||||
? Utils.numFormat(
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules!
|
||||
.modules
|
||||
.moduleStat!
|
||||
.forward!
|
||||
.count)
|
||||
@@ -638,7 +638,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
.moduleStat
|
||||
?.like
|
||||
?.status ==
|
||||
true
|
||||
@@ -648,7 +648,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
color: _dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
.moduleStat
|
||||
?.like
|
||||
?.status ==
|
||||
true
|
||||
@@ -662,7 +662,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
.moduleStat
|
||||
?.like
|
||||
?.status ==
|
||||
true
|
||||
@@ -689,14 +689,14 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
.moduleStat
|
||||
?.like
|
||||
?.count !=
|
||||
null
|
||||
? Utils.numFormat(
|
||||
_dynamicDetailController
|
||||
.item
|
||||
.modules!
|
||||
.modules
|
||||
.moduleStat!
|
||||
.like!
|
||||
.count)
|
||||
@@ -705,7 +705,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
color: _dynamicDetailController
|
||||
.item
|
||||
.modules
|
||||
?.moduleStat
|
||||
.moduleStat
|
||||
?.like
|
||||
?.status ==
|
||||
true
|
||||
|
||||
@@ -34,7 +34,7 @@ class RepostPanel extends CommonPublishPage {
|
||||
final String? uname;
|
||||
final bool? isMax;
|
||||
|
||||
final dynamic item;
|
||||
final DynamicItemModel? item;
|
||||
final VoidCallback? callback;
|
||||
|
||||
@override
|
||||
@@ -44,53 +44,19 @@ class RepostPanel extends CommonPublishPage {
|
||||
class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
||||
late bool _isMax = widget.isMax ?? false;
|
||||
|
||||
late final dynamic _pic = widget.pic ??
|
||||
(widget.item as DynamicItemModel?)
|
||||
?.modules
|
||||
?.moduleDynamic
|
||||
?.major
|
||||
?.archive
|
||||
?.cover ??
|
||||
(widget.item as DynamicItemModel?)
|
||||
?.modules
|
||||
?.moduleDynamic
|
||||
?.major
|
||||
?.pgc
|
||||
?.cover ??
|
||||
(widget.item as DynamicItemModel?)
|
||||
?.modules
|
||||
?.moduleDynamic
|
||||
?.major
|
||||
?.opus
|
||||
?.pics
|
||||
?.firstOrNull
|
||||
?.url;
|
||||
late final _pic = widget.pic ??
|
||||
widget.item?.modules.moduleDynamic?.major?.archive?.cover ??
|
||||
widget.item?.modules.moduleDynamic?.major?.pgc?.cover ??
|
||||
widget.item?.modules.moduleDynamic?.major?.opus?.pics?.firstOrNull?.url;
|
||||
|
||||
late final _text = widget.title ??
|
||||
(widget.item as DynamicItemModel?)
|
||||
?.modules
|
||||
?.moduleDynamic
|
||||
?.major
|
||||
?.opus
|
||||
?.summary
|
||||
?.text ??
|
||||
(widget.item as DynamicItemModel?)?.modules?.moduleDynamic?.desc?.text ??
|
||||
(widget.item as DynamicItemModel?)
|
||||
?.modules
|
||||
?.moduleDynamic
|
||||
?.major
|
||||
?.archive
|
||||
?.title ??
|
||||
(widget.item as DynamicItemModel?)
|
||||
?.modules
|
||||
?.moduleDynamic
|
||||
?.major
|
||||
?.pgc
|
||||
?.title ??
|
||||
widget.item?.modules.moduleDynamic?.major?.opus?.summary?.text ??
|
||||
widget.item?.modules.moduleDynamic?.desc?.text ??
|
||||
widget.item?.modules.moduleDynamic?.major?.archive?.title ??
|
||||
widget.item?.modules.moduleDynamic?.major?.pgc?.title ??
|
||||
'';
|
||||
|
||||
late final _uname = widget.uname ??
|
||||
(widget.item as DynamicItemModel?)?.modules?.moduleAuthor?.name;
|
||||
late final _uname = widget.uname ?? widget.item?.modules.moduleAuthor?.name;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
||||
@@ -162,7 +162,7 @@ class _DynamicsTabPageState
|
||||
] else ...[
|
||||
for (var i in loadingState.response!)
|
||||
if (!dynamicsController.tempBannedList
|
||||
.contains(i.modules?.moduleAuthor?.mid))
|
||||
.contains(i.modules.moduleAuthor?.mid))
|
||||
DynamicPanel(
|
||||
item: i,
|
||||
onRemove: controller.onRemove,
|
||||
@@ -185,7 +185,7 @@ class _DynamicsTabPageState
|
||||
4 &&
|
||||
dynamicsController.mid.value != -1) ||
|
||||
!dynamicsController.tempBannedList.contains(
|
||||
item.modules?.moduleAuthor?.mid)) {
|
||||
item.modules.moduleAuthor?.mid)) {
|
||||
return DynamicPanel(
|
||||
item: item,
|
||||
onRemove: controller.onRemove,
|
||||
|
||||
@@ -12,9 +12,9 @@ import 'package:PiliPlus/utils/feed_back.dart';
|
||||
class ActionPanel extends StatefulWidget {
|
||||
const ActionPanel({
|
||||
super.key,
|
||||
this.item,
|
||||
required this.item,
|
||||
});
|
||||
final dynamic item;
|
||||
final DynamicItemModel item;
|
||||
|
||||
@override
|
||||
State<ActionPanel> createState() => _ActionPanelState();
|
||||
@@ -33,26 +33,22 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
// 动态点赞
|
||||
Future onLikeDynamic() async {
|
||||
feedBack();
|
||||
var item = widget.item!;
|
||||
final item = widget.item;
|
||||
String dynamicId = item.idStr!;
|
||||
// 1 已点赞 2 不喜欢 0 未操作
|
||||
Like like = item.modules.moduleStat.like;
|
||||
int count = like.count == '点赞' ? 0 : int.parse(like.count ?? '0');
|
||||
bool status = like.status!;
|
||||
DynamicStat? like = item.modules.moduleStat?.like;
|
||||
int count = like?.count ?? 0;
|
||||
bool status = like?.status == true;
|
||||
int up = status ? 2 : 1;
|
||||
var res = await DynamicsHttp.likeDynamic(dynamicId: dynamicId, up: up);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast(!status ? '点赞成功' : '取消赞');
|
||||
if (up == 1) {
|
||||
item.modules.moduleStat.like.count = (count + 1).toString();
|
||||
item.modules.moduleStat.like.status = true;
|
||||
item.modules.moduleStat?.like?.count = count + 1;
|
||||
item.modules.moduleStat?.like?.status = true;
|
||||
} else {
|
||||
if (count == 1) {
|
||||
item.modules.moduleStat.like.count = '点赞';
|
||||
} else {
|
||||
item.modules.moduleStat.like.count = (count - 1).toString();
|
||||
}
|
||||
item.modules.moduleStat.like.status = false;
|
||||
item.modules.moduleStat?.like?.count = count - 1;
|
||||
item.modules.moduleStat?.like?.status = false;
|
||||
}
|
||||
setState(() {});
|
||||
} else {
|
||||
@@ -78,12 +74,9 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
builder: (context) => RepostPanel(
|
||||
item: widget.item,
|
||||
callback: () {
|
||||
int count = int.tryParse(
|
||||
widget.item!.modules.moduleStat.forward?.count ??
|
||||
'0') ??
|
||||
0;
|
||||
widget.item!.modules.moduleStat.forward!.count =
|
||||
(count + 1).toString();
|
||||
int count =
|
||||
widget.item.modules.moduleStat?.forward?.count ?? 0;
|
||||
widget.item.modules.moduleStat!.forward!.count = count + 1;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
@@ -100,9 +93,9 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
label: Text(
|
||||
widget.item!.modules.moduleStat.forward!.count != null
|
||||
widget.item.modules.moduleStat!.forward!.count != null
|
||||
? Utils.numFormat(
|
||||
widget.item!.modules.moduleStat.forward!.count)
|
||||
widget.item.modules.moduleStat!.forward!.count)
|
||||
: '转发',
|
||||
),
|
||||
),
|
||||
@@ -123,9 +116,9 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
label: Text(
|
||||
widget.item!.modules.moduleStat.comment!.count != null
|
||||
widget.item.modules.moduleStat!.comment!.count != null
|
||||
? Utils.numFormat(
|
||||
widget.item!.modules.moduleStat.comment!.count)
|
||||
widget.item.modules.moduleStat!.comment!.count)
|
||||
: '评论',
|
||||
),
|
||||
),
|
||||
@@ -135,15 +128,15 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
child: TextButton.icon(
|
||||
onPressed: () => handleState(onLikeDynamic),
|
||||
icon: Icon(
|
||||
widget.item!.modules.moduleStat.like!.status!
|
||||
widget.item.modules.moduleStat!.like!.status!
|
||||
? FontAwesomeIcons.solidThumbsUp
|
||||
: FontAwesomeIcons.thumbsUp,
|
||||
size: 16,
|
||||
color: widget.item!.modules.moduleStat.like!.status!
|
||||
color: widget.item.modules.moduleStat!.like!.status!
|
||||
? primary
|
||||
: color,
|
||||
semanticLabel:
|
||||
widget.item!.modules.moduleStat.like!.status! ? "已赞" : "点赞",
|
||||
widget.item.modules.moduleStat!.like!.status! ? "已赞" : "点赞",
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||
@@ -155,14 +148,15 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
widget.item!.modules.moduleStat.like!.count != null
|
||||
widget.item.modules.moduleStat!.like!.count != null
|
||||
? Utils.numFormat(
|
||||
widget.item!.modules.moduleStat.like!.count)
|
||||
widget.item.modules.moduleStat!.like!.count)
|
||||
: '点赞',
|
||||
key: ValueKey<String>(
|
||||
widget.item!.modules.moduleStat.like!.count ?? '点赞'),
|
||||
widget.item.modules.moduleStat!.like!.count?.toString() ??
|
||||
'点赞'),
|
||||
style: TextStyle(
|
||||
color: widget.item!.modules.moduleStat.like!.status!
|
||||
color: widget.item.modules.moduleStat!.like!.status!
|
||||
? primary
|
||||
: color,
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
@@ -74,8 +74,8 @@ class DynamicPanel extends StatelessWidget {
|
||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 6),
|
||||
child: authorWidget,
|
||||
),
|
||||
if (item.modules!.moduleDynamic!.desc != null ||
|
||||
item.modules!.moduleDynamic!.major != null)
|
||||
if (item.modules.moduleDynamic!.desc != null ||
|
||||
item.modules.moduleDynamic!.major != null)
|
||||
content(isSave, context, item, source, callback),
|
||||
forWard(isSave, item, context, source, callback),
|
||||
const SizedBox(height: 2),
|
||||
@@ -94,7 +94,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
) {
|
||||
late String? title;
|
||||
late String? cover;
|
||||
late final major = item.modules?.moduleDynamic?.major;
|
||||
late final major = item.modules.moduleDynamic?.major;
|
||||
switch (item.type) {
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
title = major?.archive?.title;
|
||||
|
||||
@@ -143,7 +143,7 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback,
|
||||
item.modules.moduleDynamic.additional.type,
|
||||
floor: floor,
|
||||
),
|
||||
if (item?.modules?.moduleDynamic?.major?.blocked != null)
|
||||
if (item?.modules.moduleDynamic?.major?.blocked != null)
|
||||
_blockedItem(context, item, source),
|
||||
],
|
||||
);
|
||||
@@ -155,27 +155,27 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback,
|
||||
return switch (item) {
|
||||
DynamicItemModel() => item.isForwarded == true
|
||||
? articlePanel(source, item, context, callback, floor: floor)
|
||||
: item.modules?.moduleDynamic?.major?.blocked != null
|
||||
: item.modules.moduleDynamic?.major?.blocked != null
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (item.modules?.moduleDynamic?.major
|
||||
if (item.modules.moduleDynamic?.major
|
||||
?.blocked?['title'] !=
|
||||
null)
|
||||
Text(
|
||||
'${item.modules?.moduleDynamic?.major?.blocked!['title']}',
|
||||
'${item.modules.moduleDynamic?.major?.blocked!['title']}',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
if (item.modules?.moduleDynamic?.major
|
||||
if (item.modules.moduleDynamic?.major
|
||||
?.blocked?['hint_message'] !=
|
||||
null)
|
||||
Text(
|
||||
'${item.modules?.moduleDynamic?.major?.blocked!['hint_message']}',
|
||||
'${item.modules.moduleDynamic?.major?.blocked!['hint_message']}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
@@ -304,7 +304,7 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback,
|
||||
item.modules.moduleDynamic.additional.type,
|
||||
floor: floor,
|
||||
)
|
||||
: item?.modules?.moduleDynamic?.major?.blocked != null
|
||||
: item?.modules.moduleDynamic?.major?.blocked != null
|
||||
? _blockedItem(context, item, source)
|
||||
: const SizedBox(height: 0);
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
|
||||
Reference in New Issue
Block a user