mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
feat: save dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -4,7 +4,7 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
import '../../../common/constants.dart';
|
||||
import 'pic_panel.dart';
|
||||
|
||||
Widget articlePanel(item, context, callback, {floor = 1}) {
|
||||
Widget articlePanel(source, item, context, callback, {floor = 1}) {
|
||||
TextStyle authorStyle =
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||
return Padding(
|
||||
@@ -46,9 +46,9 @@ Widget articlePanel(item, context, callback, {floor = 1}) {
|
||||
Text(
|
||||
item.modules.moduleDynamic.major.opus.summary.richTextNodes.first
|
||||
.text,
|
||||
maxLines: 4,
|
||||
maxLines: source == 'detail' ? null : 4,
|
||||
style: const TextStyle(height: 1.55),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/report.dart';
|
||||
import 'package:PiliPlus/common/widgets/save_panel.dart';
|
||||
import 'package:PiliPlus/http/index.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -310,6 +311,16 @@ class AuthorPanel extends StatelessWidget {
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
SavePanel.toSavePanel(item: item);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.save_alt, size: 19),
|
||||
title:
|
||||
Text('保存动态', style: Theme.of(context).textTheme.titleSmall!),
|
||||
),
|
||||
if (item.modules.moduleAuthor.mid == Accounts.main.mid) ...[
|
||||
ListTile(
|
||||
onTap: () {
|
||||
|
||||
@@ -14,12 +14,14 @@ class DynamicPanel extends StatelessWidget {
|
||||
final String? source;
|
||||
final Function? onRemove;
|
||||
final Function(List<String>, int)? callback;
|
||||
final bool? isSave;
|
||||
|
||||
const DynamicPanel({
|
||||
required this.item,
|
||||
this.source,
|
||||
this.onRemove,
|
||||
this.callback,
|
||||
this.isSave,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@@ -29,8 +31,9 @@ class DynamicPanel extends StatelessWidget {
|
||||
// padding: source == 'detail'
|
||||
// ? const EdgeInsets.only(bottom: 12)
|
||||
// : EdgeInsets.zero,
|
||||
decoration: source == 'detail' &&
|
||||
Get.context!.orientation == Orientation.landscape
|
||||
decoration: isSave == true ||
|
||||
(source == 'detail' &&
|
||||
Get.context!.orientation == Orientation.landscape)
|
||||
? null
|
||||
: BoxDecoration(
|
||||
border: Border(
|
||||
@@ -138,7 +141,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),
|
||||
if (source == 'detail' && isSave != true) const SizedBox(height: 12),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -160,12 +160,12 @@ Widget forWard(item, BuildContext context, source, callback, {floor = 1}) {
|
||||
);
|
||||
// 视频
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
return videoSeasonWidget(item, context, 'archive', floor: floor);
|
||||
return videoSeasonWidget(source, item, context, 'archive', floor: floor);
|
||||
// 文章
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
return switch (item) {
|
||||
DynamicItemModel() => item.isForwarded == true
|
||||
? articlePanel(item, context, callback, floor: floor)
|
||||
? articlePanel(source, item, context, callback, floor: floor)
|
||||
: item.modules?.moduleDynamic?.major?.blocked != null
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
@@ -260,13 +260,13 @@ Widget forWard(item, BuildContext context, source, callback, {floor = 1}) {
|
||||
);
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
return liveRcmdPanel(item, context, floor: floor);
|
||||
return liveRcmdPanel(source, item, context, floor: floor);
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
return livePanel(item, context, floor: floor);
|
||||
return livePanel(source, item, context, floor: floor);
|
||||
// 合集
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
return videoSeasonWidget(item, context, 'ugcSeason');
|
||||
return videoSeasonWidget(source, item, context, 'ugcSeason');
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
InlineSpan? richNodes = richNode(item, context);
|
||||
return floor == 2
|
||||
@@ -318,9 +318,9 @@ Widget forWard(item, BuildContext context, source, callback, {floor = 1}) {
|
||||
? _blockedItem(context, item, source)
|
||||
: const SizedBox(height: 0);
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
||||
return videoSeasonWidget(source, item, context, 'pgc', floor: floor);
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
||||
return videoSeasonWidget(source, item, context, 'pgc', floor: floor);
|
||||
// 直播结束
|
||||
case 'DYNAMIC_TYPE_NONE':
|
||||
return Row(
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
import 'rich_node_panel.dart';
|
||||
|
||||
Widget livePanel(item, context, {floor = 1}) {
|
||||
Widget livePanel(source, item, context, {floor = 1}) {
|
||||
dynamic content = item.modules.moduleDynamic.major;
|
||||
late final TextStyle authorStyle =
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||
@@ -85,8 +85,8 @@ Widget livePanel(item, context, {floor = 1}) {
|
||||
children: [
|
||||
Text(
|
||||
content.live.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: source == 'detail' ? null : 2,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
import 'rich_node_panel.dart';
|
||||
|
||||
Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
Widget liveRcmdPanel(source, item, context, {floor = 1}) {
|
||||
TextStyle authorStyle =
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
||||
@@ -144,9 +144,9 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
padding: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: Text(
|
||||
item.modules.moduleDynamic.major.liveRcmd.title,
|
||||
maxLines: 1,
|
||||
maxLines: source == 'detail' ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
import 'rich_node_panel.dart';
|
||||
|
||||
Widget videoSeasonWidget(item, context, type, {floor = 1}) {
|
||||
Widget videoSeasonWidget(source, item, context, type, {floor = 1}) {
|
||||
if (item.modules.moduleDynamic.major?.type == 'MAJOR_TYPE_NONE') {
|
||||
return item.modules.moduleDynamic.major?.none?.tips != null
|
||||
? Row(
|
||||
@@ -196,9 +196,9 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
|
||||
: EdgeInsets.zero,
|
||||
child: Text(
|
||||
content.title,
|
||||
maxLines: 1,
|
||||
maxLines: source == 'detail' ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user