mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: dyn: show medialist type
Closes #462 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -410,6 +410,7 @@ class DynamicMajorModel {
|
||||
this.common,
|
||||
this.music,
|
||||
this.blocked,
|
||||
this.medialist,
|
||||
});
|
||||
|
||||
DynamicArchiveModel? archive;
|
||||
@@ -428,6 +429,7 @@ class DynamicMajorModel {
|
||||
Map? common;
|
||||
Map? music;
|
||||
Map? blocked;
|
||||
Map? medialist;
|
||||
|
||||
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
||||
archive = json['archive'] != null
|
||||
@@ -454,6 +456,7 @@ class DynamicMajorModel {
|
||||
common = json['common'] ?? {};
|
||||
music = json['music'] ?? {};
|
||||
blocked = json['blocked'];
|
||||
medialist = json['medialist'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ class DynamicPanel extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: source == 'detail'
|
||||
? const EdgeInsets.only(bottom: 12)
|
||||
: EdgeInsets.zero,
|
||||
// padding: source == 'detail'
|
||||
// ? const EdgeInsets.only(bottom: 12)
|
||||
// : EdgeInsets.zero,
|
||||
decoration: source == 'detail' &&
|
||||
Get.context!.orientation == Orientation.landscape
|
||||
? null
|
||||
@@ -56,6 +56,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
'DYNAMIC_TYPE_PGC',
|
||||
'DYNAMIC_TYPE_LIVE',
|
||||
'DYNAMIC_TYPE_LIVE_RCMD',
|
||||
'DYNAMIC_TYPE_MEDIALIST',
|
||||
].contains(item.type).not
|
||||
? null
|
||||
: () => Utils.pushDynDetail(item, 1),
|
||||
@@ -137,6 +138,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
forWard(item, context, source, callback),
|
||||
const SizedBox(height: 2),
|
||||
if (source == null) ActionPanel(item: item),
|
||||
if (source == 'detail') const SizedBox(height: 12),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// 转发
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/imageview.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -37,7 +39,7 @@ InlineSpan picsNodes(List<OpusPicsModel> pics, callback) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget forWard(item, context, source, callback, {floor = 1}) {
|
||||
Widget forWard(item, BuildContext context, source, callback, {floor = 1}) {
|
||||
switch (item.type) {
|
||||
// 图文
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
@@ -448,6 +450,112 @@ Widget forWard(item, context, source, callback, {floor = 1}) {
|
||||
),
|
||||
),
|
||||
);
|
||||
case 'DYNAMIC_TYPE_MEDIALIST':
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (floor == 2) ...[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 28,
|
||||
height: 28,
|
||||
type: 'avatar',
|
||||
src: item.modules.moduleAuthor.face,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
item.modules.moduleAuthor.name,
|
||||
style: TextStyle(
|
||||
color: item.modules.moduleAuthor!.vip != null &&
|
||||
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
||||
item.modules.moduleAuthor!.vip['type'] == 2
|
||||
? context.vipColor
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.titleMedium!.fontSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (floor == 1) const SizedBox(width: 12),
|
||||
Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: item.modules.moduleDynamic.major.medialist['cover'],
|
||||
child: NetworkImgLayer(
|
||||
width: 180,
|
||||
height: 110,
|
||||
src: item.modules.moduleDynamic.major.medialist['cover'],
|
||||
),
|
||||
),
|
||||
if (item.modules.moduleDynamic.major.medialist['badge']
|
||||
?['text'] !=
|
||||
null)
|
||||
PBadge(
|
||||
right: 6,
|
||||
top: 6,
|
||||
text: item.modules.moduleDynamic.major.medialist['badge']
|
||||
['text'],
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 110,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
item.modules.moduleDynamic.major.medialist['title'],
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (item.modules.moduleDynamic.major
|
||||
.medialist['sub_title'] !=
|
||||
null) ...[
|
||||
const Spacer(),
|
||||
Text(
|
||||
item.modules.moduleDynamic.major
|
||||
.medialist['sub_title'],
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge!
|
||||
.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (floor == 1) const SizedBox(width: 12),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:PiliPlus/models/space_fav/datum.dart';
|
||||
import 'package:PiliPlus/models/space_fav/list.dart';
|
||||
import 'package:PiliPlus/models/user/sub_folder.dart';
|
||||
import 'package:PiliPlus/pages/member/new/content/member_contribute/content/favorite/member_favorite_ctr.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -116,6 +115,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
|
||||
// invalid
|
||||
return;
|
||||
}
|
||||
|
||||
if (item1.type == 0) {
|
||||
dynamic res = await Get.toNamed(
|
||||
'/favDetail',
|
||||
@@ -133,13 +133,11 @@ class _MemberFavoriteState extends State<MemberFavorite>
|
||||
_controller.onRefresh();
|
||||
});
|
||||
}
|
||||
} else if (item1.type == 21) {
|
||||
PiliScheme.routePushFromUrl(item1.link ?? '');
|
||||
} else if (item1.type == 11) {
|
||||
} else {
|
||||
Get.toNamed(
|
||||
'/subDetail',
|
||||
arguments: SubFolderItemData(
|
||||
type: 11,
|
||||
type: item1.type,
|
||||
title: item1.title,
|
||||
cover: item1.cover,
|
||||
upper: Upper(
|
||||
|
||||
@@ -23,16 +23,15 @@ class SubDetailPage extends StatefulWidget {
|
||||
|
||||
class _SubDetailPageState extends State<SubDetailPage> {
|
||||
late final ScrollController _controller = ScrollController();
|
||||
late final SubDetailController _subDetailController =
|
||||
Get.put(SubDetailController(), tag: Utils.makeHeroTag(id));
|
||||
late final SubDetailController _subDetailController = Get.put(
|
||||
SubDetailController(),
|
||||
tag: Utils.makeHeroTag(Get.parameters['id']));
|
||||
late StreamController<bool> titleStreamC;
|
||||
late Future _futureBuilderFuture;
|
||||
late String id;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
id = Get.parameters['id']!;
|
||||
_futureBuilderFuture = _subDetailController.queryUserSubFolderDetail();
|
||||
titleStreamC = StreamController<bool>();
|
||||
_controller.addListener(listener);
|
||||
|
||||
@@ -647,6 +647,25 @@ class Utils {
|
||||
Utils.viewBangumi(epId: pgc.epid);
|
||||
}
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_MEDIALIST':
|
||||
if (item.modules?.moduleDynamic?.major?.medialist != null) {
|
||||
final String? url =
|
||||
item.modules.moduleDynamic.major.medialist['jump_url'];
|
||||
if (url?.contains('medialist/detail/ml') == true) {
|
||||
Get.toNamed(
|
||||
'/favDetail',
|
||||
parameters: {
|
||||
'heroTag':
|
||||
'${item.modules.moduleDynamic.major.medialist['cover']}',
|
||||
'mediaId':
|
||||
'${item.modules.moduleDynamic.major.medialist['id']}',
|
||||
},
|
||||
);
|
||||
} else if (url != null) {
|
||||
handleWebview(url.http2https);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// case 'DYNAMIC_TYPE_COMMON_SQUARE':
|
||||
// /// 转发的动态
|
||||
|
||||
Reference in New Issue
Block a user