mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 07:06:14 +08:00
dyn sub card
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:PiliPlus/pages/article/widgets/opus_content.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/additional_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/article_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/live_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/live_panel_sub.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/live_rcmd_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/pic_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/rich_node_panel.dart';
|
||||
@@ -524,10 +525,16 @@ Widget forWard(
|
||||
],
|
||||
);
|
||||
|
||||
case 'DYNAMIC_TYPE_SUBSCRIPTION_NEW'
|
||||
when item.modules.moduleDynamic?.major?.type ==
|
||||
'MAJOR_TYPE_SUBSCRIPTION_NEW':
|
||||
return livePanelSub(theme, source, item, context, floor: floor);
|
||||
default:
|
||||
return const SizedBox(
|
||||
width: double.infinity,
|
||||
child: Text('🙏 暂未支持的类型,请联系开发者反馈 '),
|
||||
return Padding(
|
||||
padding: floor == 1
|
||||
? const EdgeInsets.symmetric(horizontal: 12)
|
||||
: EdgeInsets.zero,
|
||||
child: Text('暂未支持的类型: \n${item.idStr}\n${item.type}'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ Widget livePanel(
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
late final authorStyle = TextStyle(color: theme.colorScheme.primary);
|
||||
TextSpan? richNodes = richNode(theme, item, context);
|
||||
late TextSpan? richNodes = richNode(theme, item, context);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
167
lib/pages/dynamics/widgets/live_panel_sub.dart
Normal file
167
lib/pages/dynamics/widgets/live_panel_sub.dart
Normal file
@@ -0,0 +1,167 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/rich_node_panel.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
Widget livePanelSub(
|
||||
ThemeData theme,
|
||||
String? source,
|
||||
DynamicItemModel item,
|
||||
BuildContext context, {
|
||||
int floor = 1,
|
||||
}) {
|
||||
SubscriptionNew? subItem = item.modules.moduleDynamic!.major?.subscriptionNew;
|
||||
LivePlayInfo? content = subItem?.liveRcmd?.content?.livePlayInfo;
|
||||
if (subItem == null || content == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
late TextSpan? richNodes = richNode(theme, item, context);
|
||||
late final authorStyle = TextStyle(color: theme.colorScheme.primary);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (floor == 2) ...[
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Get.toNamed(
|
||||
'/member?mid=${item.modules.moduleAuthor?.mid}',
|
||||
arguments: {'face': item.modules.moduleAuthor?.face},
|
||||
),
|
||||
child: Text(
|
||||
'@${item.modules.moduleAuthor?.name}',
|
||||
style: authorStyle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
Utils.dateFormat(item.modules.moduleAuthor?.pubTs),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
if (item.modules.moduleDynamic?.topic != null) ...[
|
||||
GestureDetector(
|
||||
onTap: () => Get.toNamed(
|
||||
'/dynTopic',
|
||||
parameters: {
|
||||
'id': item.modules.moduleDynamic!.topic!.id!.toString(),
|
||||
'name': item.modules.moduleDynamic!.topic!.name!,
|
||||
},
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: Text(
|
||||
'#${item.modules.moduleDynamic!.topic!.name}',
|
||||
style: authorStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
if (floor == 2 &&
|
||||
item.modules.moduleDynamic?.desc != null &&
|
||||
richNodes != null) ...[
|
||||
Text.rich(richNodes),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.toNamed('/liveRoom?roomid=${content.roomId}'),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, box) {
|
||||
double width = box.maxWidth;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Hero(
|
||||
tag: content.roomId.toString(),
|
||||
child: NetworkImgLayer(
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
),
|
||||
),
|
||||
PBadge(
|
||||
text: content.watchedShow?.textLarge,
|
||||
top: 6,
|
||||
right: 56,
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
PBadge(
|
||||
text: content.liveStatus == 1 ? '直播中' : '直播结束',
|
||||
top: 6,
|
||||
right: 6,
|
||||
),
|
||||
if (content.areaName != null)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 80,
|
||||
alignment: Alignment.bottomLeft,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 10, 10),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black45,
|
||||
],
|
||||
),
|
||||
borderRadius: floor == 1
|
||||
? const BorderRadius.only(
|
||||
bottomLeft: StyleString.imgRadius,
|
||||
bottomRight: StyleString.imgRadius,
|
||||
)
|
||||
: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(6),
|
||||
bottomRight: Radius.circular(6),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
content.areaName!,
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
if (content.title != null)
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: Text(
|
||||
content.title!,
|
||||
maxLines: source == 'detail' ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -20,9 +20,7 @@ Widget liveRcmdPanel(
|
||||
if (liveRcmd == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
int? liveStatus = liveRcmd.liveStatus;
|
||||
Map? watchedShow = liveRcmd.watchedShow;
|
||||
TextSpan? richNodes = richNode(theme, item, context);
|
||||
late TextSpan? richNodes = richNode(theme, item, context);
|
||||
late final authorStyle = TextStyle(color: theme.colorScheme.primary);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -97,13 +95,13 @@ Widget liveRcmdPanel(
|
||||
),
|
||||
),
|
||||
PBadge(
|
||||
text: watchedShow?['text_large'],
|
||||
text: liveRcmd.watchedShow?.textLarge,
|
||||
top: 6,
|
||||
right: 56,
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
PBadge(
|
||||
text: liveStatus == 1 ? '直播中' : '直播结束',
|
||||
text: liveRcmd.liveStatus == 1 ? '直播中' : '直播结束',
|
||||
top: 6,
|
||||
right: 6,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user