mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 17:46:24 +08:00
@@ -22,7 +22,7 @@ import 'package:get/get.dart';
|
||||
class AuthorPanel extends StatelessWidget {
|
||||
final DynamicItemModel item;
|
||||
final Function? addBannedList;
|
||||
final String? source;
|
||||
final bool isDetail;
|
||||
final ValueChanged? onRemove;
|
||||
final bool isSave;
|
||||
final Function(bool isTop, dynamic dynId)? onSetTop;
|
||||
@@ -32,7 +32,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
super.key,
|
||||
required this.item,
|
||||
this.addBannedList,
|
||||
this.source,
|
||||
this.isDetail = false,
|
||||
this.onRemove,
|
||||
this.isSave = false,
|
||||
this.onSetTop,
|
||||
@@ -119,7 +119,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: source != 'detail' && item.modules.moduleTag?.text != null
|
||||
child: !isDetail && item.modules.moduleTag?.text != null
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
||||
@@ -11,7 +11,7 @@ Widget content(
|
||||
bool isSave,
|
||||
BuildContext context,
|
||||
DynamicItemModel item,
|
||||
String? source,
|
||||
bool isDetail,
|
||||
Function(List<String>, int)? callback, {
|
||||
floor = 1,
|
||||
}) {
|
||||
@@ -53,7 +53,7 @@ Widget content(
|
||||
style: TextStyle(
|
||||
fontSize: floor != 1
|
||||
? 14
|
||||
: source == 'detail' && !isSave
|
||||
: isDetail && !isSave
|
||||
? 16
|
||||
: 15,
|
||||
color: theme.colorScheme.primary,
|
||||
@@ -61,7 +61,7 @@ Widget content(
|
||||
),
|
||||
),
|
||||
if (richNodes != null)
|
||||
source == 'detail' && floor == 1
|
||||
isDetail && floor == 1
|
||||
? SelectableText.rich(
|
||||
richNodes,
|
||||
style: isSave
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:get/get.dart';
|
||||
|
||||
class DynamicPanel extends StatelessWidget {
|
||||
final DynamicItemModel item;
|
||||
final String? source;
|
||||
final bool isDetail;
|
||||
final ValueChanged? onRemove;
|
||||
final Function(List<String>, int)? callback;
|
||||
final bool isSave;
|
||||
@@ -22,7 +22,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
const DynamicPanel({
|
||||
super.key,
|
||||
required this.item,
|
||||
this.source,
|
||||
this.isDetail = false,
|
||||
this.onRemove,
|
||||
this.callback,
|
||||
this.isSave = false,
|
||||
@@ -35,7 +35,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
final theme = Theme.of(context);
|
||||
final authorWidget = AuthorPanel(
|
||||
item: item,
|
||||
source: source,
|
||||
isDetail: isDetail,
|
||||
onRemove: onRemove,
|
||||
isSave: isSave,
|
||||
onSetTop: onSetTop,
|
||||
@@ -45,7 +45,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
elevation: 0,
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: source == 'detail' &&
|
||||
onTap: isDetail &&
|
||||
!const {
|
||||
'DYNAMIC_TYPE_AV',
|
||||
'DYNAMIC_TYPE_UGC_SEASON',
|
||||
@@ -67,22 +67,21 @@ class DynamicPanel extends StatelessWidget {
|
||||
child: authorWidget,
|
||||
),
|
||||
if (item.type != 'DYNAMIC_TYPE_NONE')
|
||||
content(theme, isSave, context, item, source, callback),
|
||||
module(theme, isSave, item, context, source, callback),
|
||||
content(theme, isSave, context, item, isDetail, callback),
|
||||
module(theme, isSave, item, context, isDetail, callback),
|
||||
if (item.modules.moduleDynamic?.additional != null)
|
||||
addWidget(theme, item, context),
|
||||
if (item.modules.moduleDynamic?.major?.blocked != null)
|
||||
blockedItem(theme, item.modules.moduleDynamic!.major!.blocked!),
|
||||
const SizedBox(height: 2),
|
||||
if (source == null) ActionPanel(item: item),
|
||||
if (source == 'detail' && !isSave) const SizedBox(height: 12),
|
||||
if (!isDetail) ActionPanel(item: item),
|
||||
if (isDetail && !isSave) const SizedBox(height: 12),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
if (isSave ||
|
||||
(source == 'detail' &&
|
||||
Get.context!.orientation == Orientation.landscape)) {
|
||||
(isDetail && Get.context!.orientation == Orientation.landscape)) {
|
||||
return child;
|
||||
}
|
||||
return DecoratedBox(
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:get/get.dart';
|
||||
|
||||
Widget livePanel(
|
||||
ThemeData theme,
|
||||
String? source,
|
||||
bool isDetail,
|
||||
DynamicItemModel item,
|
||||
BuildContext context, {
|
||||
int floor = 1,
|
||||
@@ -45,8 +45,8 @@ Widget livePanel(
|
||||
children: [
|
||||
Text(
|
||||
content.live!.title!,
|
||||
maxLines: source == 'detail' ? null : 2,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
maxLines: isDetail ? null : 2,
|
||||
overflow: isDetail ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
if (content.live?.descFirst != null)
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:get/get.dart';
|
||||
|
||||
Widget livePanelSub(
|
||||
ThemeData theme,
|
||||
String? source,
|
||||
bool isDetail,
|
||||
DynamicItemModel item,
|
||||
BuildContext context, {
|
||||
int floor = 1,
|
||||
@@ -113,9 +113,9 @@ Widget livePanelSub(
|
||||
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: Text(
|
||||
content.title!,
|
||||
maxLines: source == 'detail' ? null : 1,
|
||||
maxLines: isDetail ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
overflow: isDetail ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
Widget liveRcmdPanel(
|
||||
ThemeData theme,
|
||||
String? source,
|
||||
bool isDetail,
|
||||
DynamicItemModel item,
|
||||
BuildContext context, {
|
||||
int floor = 1,
|
||||
@@ -113,9 +113,9 @@ Widget liveRcmdPanel(
|
||||
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: Text(
|
||||
liveRcmd.title!,
|
||||
maxLines: source == 'detail' ? null : 1,
|
||||
maxLines: isDetail ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
overflow: isDetail ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
|
||||
@@ -22,7 +22,7 @@ Widget module(
|
||||
bool isSave,
|
||||
DynamicItemModel item,
|
||||
BuildContext context,
|
||||
String? source,
|
||||
bool isDetail,
|
||||
Function(List<String>, int)? callback, {
|
||||
floor = 1,
|
||||
}) {
|
||||
@@ -36,7 +36,7 @@ Widget module(
|
||||
// 视频
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
return videoSeasonWidget(
|
||||
theme, isSave, source, item, context, 'archive', callback,
|
||||
theme, isSave, isDetail, item, context, 'archive', callback,
|
||||
floor: floor);
|
||||
// 转发
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
@@ -45,108 +45,134 @@ Widget module(
|
||||
orig.modules.moduleDynamic?.major?.type == 'MAJOR_TYPE_NONE';
|
||||
late final isNormalAuth =
|
||||
orig.modules.moduleAuthor!.type == 'AUTHOR_TYPE_NORMAL';
|
||||
return InkWell(
|
||||
onTap:
|
||||
isNoneMajor ? null : () => PageUtils.pushDynDetail(orig, floor + 1),
|
||||
onLongPress: isNoneMajor
|
||||
? null
|
||||
: () {
|
||||
late String? title, cover;
|
||||
late var origMajor = orig.modules.moduleDynamic?.major;
|
||||
late var major = item.modules.moduleDynamic?.major;
|
||||
switch (orig.type) {
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
title = origMajor?.archive?.title;
|
||||
cover = origMajor?.archive?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
title = origMajor?.ugcSeason?.title;
|
||||
cover = origMajor?.ugcSeason?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC' || 'DYNAMIC_TYPE_PGC_UNION':
|
||||
title = origMajor?.pgc?.title;
|
||||
cover = origMajor?.pgc?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
title = major?.liveRcmd?.title;
|
||||
cover = major?.liveRcmd?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
title = major?.live?.title;
|
||||
cover = major?.live?.cover;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
imageSaveDialog(
|
||||
title: title,
|
||||
cover: cover,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||
color: theme.dividerColor.withValues(alpha: 0.08),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (orig.type != 'DYNAMIC_TYPE_NONE') ...[
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: isNormalAuth
|
||||
? () => Get.toNamed(
|
||||
'/member?mid=${orig.modules.moduleAuthor!.mid}',
|
||||
arguments: {
|
||||
'face': orig.modules.moduleAuthor!.face
|
||||
},
|
||||
)
|
||||
: null,
|
||||
child: Text(
|
||||
'${isNormalAuth ? '@' : ''}${orig.modules.moduleAuthor!.name}',
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
return orig.type == 'DYNAMIC_TYPE_NONE'
|
||||
? const SizedBox.shrink()
|
||||
: InkWell(
|
||||
onTap: isNoneMajor
|
||||
? null
|
||||
: () => PageUtils.pushDynDetail(orig, floor + 1),
|
||||
onLongPress: isNoneMajor
|
||||
? null
|
||||
: () {
|
||||
late String? title, cover;
|
||||
late var origMajor = orig.modules.moduleDynamic?.major;
|
||||
late var major = item.modules.moduleDynamic?.major;
|
||||
switch (orig.type) {
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
title = origMajor?.archive?.title;
|
||||
cover = origMajor?.archive?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
title = origMajor?.ugcSeason?.title;
|
||||
cover = origMajor?.ugcSeason?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC' || 'DYNAMIC_TYPE_PGC_UNION':
|
||||
title = origMajor?.pgc?.title;
|
||||
cover = origMajor?.pgc?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
title = major?.liveRcmd?.title;
|
||||
cover = major?.liveRcmd?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
title = major?.live?.title;
|
||||
cover = major?.live?.cover;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
imageSaveDialog(
|
||||
title: title,
|
||||
cover: cover,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||
color: theme.dividerColor.withValues(alpha: 0.08),
|
||||
child: isNoneMajor
|
||||
? Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.error,
|
||||
size: 18,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
orig.modules.moduleDynamic?.major?.none?.tips ??
|
||||
'NONE',
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: isNormalAuth
|
||||
? () => Get.toNamed(
|
||||
'/member?mid=${orig.modules.moduleAuthor!.mid}',
|
||||
arguments: {
|
||||
'face':
|
||||
orig.modules.moduleAuthor!.face
|
||||
},
|
||||
)
|
||||
: null,
|
||||
child: Text(
|
||||
'${isNormalAuth ? '@' : ''}${orig.modules.moduleAuthor!.name}',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
Utils.dateFormat(
|
||||
orig.modules.moduleAuthor!.pubTs),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
fontSize:
|
||||
theme.textTheme.labelSmall!.fontSize),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
content(
|
||||
theme, isSave, context, orig, isDetail, callback,
|
||||
floor: floor + 1),
|
||||
module(
|
||||
theme, isSave, orig, context, isDetail, callback,
|
||||
floor: floor + 1),
|
||||
if (orig.modules.moduleDynamic?.additional != null)
|
||||
addWidget(theme, orig, context, floor: floor + 1),
|
||||
if (orig.modules.moduleDynamic?.major?.blocked !=
|
||||
null)
|
||||
blockedItem(theme,
|
||||
orig.modules.moduleDynamic!.major!.blocked!),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
Utils.dateFormat(orig.modules.moduleAuthor!.pubTs),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
content(theme, isSave, context, orig, source, callback,
|
||||
floor: floor + 1),
|
||||
],
|
||||
module(theme, isSave, orig, context, source, callback,
|
||||
floor: floor + 1),
|
||||
if (orig.modules.moduleDynamic?.additional != null)
|
||||
addWidget(theme, orig, context, floor: floor + 1),
|
||||
if (orig.modules.moduleDynamic?.major?.blocked != null)
|
||||
blockedItem(theme, orig.modules.moduleDynamic!.major!.blocked!),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
return liveRcmdPanel(theme, source, item, context, floor: floor);
|
||||
return liveRcmdPanel(theme, isDetail, item, context, floor: floor);
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
return livePanel(theme, source, item, context, floor: floor);
|
||||
return livePanel(theme, isDetail, item, context, floor: floor);
|
||||
// 合集
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
return videoSeasonWidget(
|
||||
theme, isSave, source, item, context, 'ugcSeason', callback);
|
||||
theme, isSave, isDetail, item, context, 'ugcSeason', callback);
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
return videoSeasonWidget(
|
||||
theme, isSave, source, item, context, 'pgc', callback,
|
||||
theme, isSave, isDetail, item, context, 'pgc', callback,
|
||||
floor: floor);
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
return videoSeasonWidget(
|
||||
theme, isSave, source, item, context, 'pgc', callback,
|
||||
theme, isSave, isDetail, item, context, 'pgc', callback,
|
||||
floor: floor);
|
||||
case 'DYNAMIC_TYPE_NONE':
|
||||
return Row(
|
||||
@@ -342,7 +368,7 @@ Widget module(
|
||||
case 'DYNAMIC_TYPE_SUBSCRIPTION_NEW'
|
||||
when item.modules.moduleDynamic?.major?.type ==
|
||||
'MAJOR_TYPE_SUBSCRIPTION_NEW':
|
||||
return livePanelSub(theme, source, item, context, floor: floor);
|
||||
return livePanelSub(theme, isDetail, item, context, floor: floor);
|
||||
|
||||
default:
|
||||
return Padding(
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
|
||||
Widget videoSeasonWidget(
|
||||
ThemeData theme,
|
||||
bool isSave,
|
||||
String? source,
|
||||
bool isDetail,
|
||||
DynamicItemModel item,
|
||||
BuildContext context,
|
||||
String type,
|
||||
@@ -29,9 +29,7 @@ Widget videoSeasonWidget(
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
item.modules.moduleDynamic!.major!.none!.tips!,
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -159,9 +157,9 @@ Widget videoSeasonWidget(
|
||||
: EdgeInsets.zero,
|
||||
child: Text(
|
||||
itemContent.title!,
|
||||
maxLines: source == 'detail' ? null : 1,
|
||||
maxLines: isDetail ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
overflow: isDetail ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user