mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
opt dyn panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,117 +3,116 @@ 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/utils/page_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget livePanelSub(
|
||||
ThemeData theme,
|
||||
bool isDetail,
|
||||
DynamicItemModel item,
|
||||
BuildContext context, {
|
||||
int floor = 1,
|
||||
required int floor,
|
||||
required ThemeData theme,
|
||||
required DynamicItemModel item,
|
||||
required bool isDetail,
|
||||
required double maxWidth,
|
||||
Function(List<String>, int)? callback,
|
||||
}) {
|
||||
maxWidth -= 24;
|
||||
SubscriptionNew? subItem = item.modules.moduleDynamic!.major?.subscriptionNew;
|
||||
LivePlayInfo? content = subItem?.liveRcmd?.content?.livePlayInfo;
|
||||
if (subItem == null || content == null) {
|
||||
LivePlayInfo? live = item
|
||||
.modules
|
||||
.moduleDynamic!
|
||||
.major
|
||||
?.subscriptionNew
|
||||
?.liveRcmd
|
||||
?.content
|
||||
?.livePlayInfo;
|
||||
if (live == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: GestureDetector(
|
||||
onTap: () => PageUtils.toLiveRoom(content.roomId),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: maxWidth,
|
||||
height: maxWidth / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
quality: 40,
|
||||
),
|
||||
PBadge(
|
||||
text: content.watchedShow?.textLarge,
|
||||
EdgeInsets padding;
|
||||
if (floor == 1) {
|
||||
maxWidth -= 24;
|
||||
padding = const EdgeInsets.symmetric(horizontal: 12);
|
||||
} else {
|
||||
padding = EdgeInsets.zero;
|
||||
}
|
||||
return Padding(
|
||||
padding: padding,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: maxWidth,
|
||||
height: maxWidth / StyleString.aspectRatio,
|
||||
src: live.cover,
|
||||
quality: 40,
|
||||
),
|
||||
PBadge(
|
||||
text: live.watchedShow?.textLarge,
|
||||
top: 6,
|
||||
right: 65,
|
||||
fontSize: 10.5,
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
if (live.liveStatus == 1)
|
||||
Positioned(
|
||||
right: 6,
|
||||
top: 6,
|
||||
right: 65,
|
||||
fontSize: 10.5,
|
||||
type: PBadgeType.gray,
|
||||
child: Image.asset(
|
||||
height: 16,
|
||||
'assets/images/live/live.gif',
|
||||
filterQuality: FilterQuality.low,
|
||||
),
|
||||
)
|
||||
else
|
||||
const PBadge(
|
||||
text: '直播结束',
|
||||
top: 6,
|
||||
right: 6,
|
||||
),
|
||||
if (content.liveStatus == 1)
|
||||
Positioned(
|
||||
right: 6,
|
||||
top: 6,
|
||||
child: Image.asset(
|
||||
height: 16,
|
||||
'assets/images/live/live.gif',
|
||||
filterQuality: FilterQuality.low,
|
||||
),
|
||||
)
|
||||
else
|
||||
const PBadge(
|
||||
text: '直播结束',
|
||||
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),
|
||||
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),
|
||||
),
|
||||
if (live.areaName case final areaName?)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 80,
|
||||
alignment: Alignment.bottomLeft,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 10, 10),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black45,
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
content.areaName!,
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: StyleString.imgRadius,
|
||||
bottomRight: StyleString.imgRadius,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
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!,
|
||||
const SizedBox(height: 6),
|
||||
if (live.title case final title?)
|
||||
Text(
|
||||
title,
|
||||
maxLines: isDetail ? null : 1,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: isDetail ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
],
|
||||
const SizedBox(height: 2),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user