opt pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-05 14:57:54 +08:00
parent b960359a39
commit 707d2f4b07
66 changed files with 1165 additions and 481 deletions

View File

@@ -9,6 +9,7 @@ import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models_new/fav/fav_detail/data.dart';
import 'package:PiliPlus/models_new/fav/fav_detail/media.dart';
import 'package:PiliPlus/models_new/fav/fav_video/list.dart';
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
import 'package:PiliPlus/pages/fav_detail/controller.dart';
import 'package:PiliPlus/pages/fav_detail/widget/fav_video_card.dart';
import 'package:PiliPlus/pages/fav_sort/view.dart';
@@ -134,6 +135,16 @@ class _FavDetailPageState extends State<FavDetailPage> {
),
icon: const Icon(Icons.search_outlined),
),
Obx(
() => Utils.isPublicFav(_favDetailController.item.value.attr ?? 0)
? IconButton(
tooltip: '分享',
onPressed: () => Utils.shareText(
'https://www.bilibili.com/medialist/detail/ml${_favDetailController.mediaId}'),
icon: const Icon(Icons.share),
)
: const SizedBox.shrink(),
),
Obx(
() => _favDetailController.isOwner.value
? PopupMenuButton(
@@ -150,6 +161,23 @@ class _FavDetailPageState extends State<FavDetailPage> {
}),
child: const Text('编辑信息'),
),
if (Utils.isPublicFav(
_favDetailController.item.value.attr ?? 0))
PopupMenuItem(
onTap: () => showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: _favDetailController.mediaId,
dynType: 4300,
pic: _favDetailController.item.value.cover,
title: _favDetailController.item.value.title,
uname: _favDetailController.item.value.upper?.name,
),
),
child: const Text('分享至动态'),
),
PopupMenuItem(
onTap: () =>
FavHttp.cleanFav(mediaId: mediaId).then((data) {
@@ -225,7 +253,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
)
: const SizedBox.shrink(),
),
const SizedBox(width: 12),
const SizedBox(width: 10),
];
List<Widget> _selectActions(ThemeData theme) => [
@@ -410,7 +438,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
children: [
Positioned.fill(
child: FavVideoCardH(
videoItem: item,
item: item,
onDelFav: _favDetailController.isOwner.value
? () => _favDetailController.onCancelFav(
index,

View File

@@ -13,7 +13,7 @@ import 'package:get/get.dart';
// 收藏视频卡片 - 水平布局
class FavVideoCardH extends StatelessWidget {
final FavDetailItemModel videoItem;
final FavDetailItemModel item;
final GestureTapCallback? onTap;
final GestureLongPressCallback? onLongPress;
final VoidCallback? onDelFav;
@@ -22,7 +22,7 @@ class FavVideoCardH extends StatelessWidget {
const FavVideoCardH({
super.key,
required this.videoItem,
required this.item,
this.onDelFav,
this.onTap,
this.onLongPress,
@@ -37,16 +37,16 @@ class FavVideoCardH extends StatelessWidget {
? null
: onTap ??
() {
if (!const [0, 16].contains(videoItem.attr)) {
Get.toNamed('/member?mid=${videoItem.upper?.mid}');
if (!const [0, 16].contains(item.attr)) {
Get.toNamed('/member?mid=${item.upper?.mid}');
return;
}
// pgc
if (videoItem.type == 24) {
if (item.type == 24) {
PageUtils.viewPgc(
seasonId: videoItem.ogv!.seasonId,
epId: videoItem.id,
seasonId: item.ogv!.seasonId,
epId: item.id,
);
return;
}
@@ -57,8 +57,8 @@ class FavVideoCardH extends StatelessWidget {
? null
: onLongPress ??
() => imageSaveDialog(
title: videoItem.title,
cover: videoItem.cover,
title: item.title,
cover: item.cover,
),
child: Padding(
padding: const EdgeInsets.symmetric(
@@ -79,18 +79,18 @@ class FavVideoCardH extends StatelessWidget {
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: videoItem.cover,
src: item.cover,
width: maxWidth,
height: maxHeight,
),
PBadge(
text: Utils.timeFormat(videoItem.duration),
text: Utils.timeFormat(item.duration),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
),
PBadge(
text: videoItem.ogv?.typeName,
text: item.ogv?.typeName,
top: 6.0,
right: 6.0,
bottom: null,
@@ -102,35 +102,45 @@ class FavVideoCardH extends StatelessWidget {
),
),
const SizedBox(width: 10),
videoContent(context),
content(context),
],
),
),
);
}
Widget videoContent(BuildContext context) {
Widget content(BuildContext context) {
final theme = Theme.of(context);
return Expanded(
child: Stack(
clipBehavior: Clip.none,
children: [
Column(
spacing: 3,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
videoItem.title!,
textAlign: TextAlign.start,
style: const TextStyle(
letterSpacing: 0.3,
),
Text(
item.title!,
textAlign: TextAlign.start,
style: const TextStyle(
letterSpacing: 0.3,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
if (item.type == 24 && item.intro?.isNotEmpty == true)
Text(
item.intro!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
),
const Spacer(),
Text(
'${Utils.dateFormat(videoItem.favTime)} ${videoItem.upper?.name}',
'${Utils.dateFormat(item.favTime)} ${item.upper?.name}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@@ -139,23 +149,22 @@ class FavVideoCardH extends StatelessWidget {
color: theme.colorScheme.outline,
),
),
const SizedBox(height: 3),
Row(
children: [
StatView(
context: context,
theme: 'gray',
value: Utils.numFormat(videoItem.cntInfo?.play),
),
const SizedBox(width: 8),
StatDanMu(
context: context,
theme: 'gray',
value: Utils.numFormat(videoItem.cntInfo?.danmaku),
),
const Spacer(),
],
),
if (item.type != 24)
Row(
spacing: 8,
children: [
StatView(
context: context,
theme: 'gray',
value: Utils.numFormat(item.cntInfo?.play),
),
StatDanMu(
context: context,
theme: 'gray',
value: Utils.numFormat(item.cntInfo?.danmaku),
),
],
),
],
),
if (onDelFav != null)