mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
show audio playlist parts
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -583,13 +583,13 @@ class AudioController extends GetxController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void playIndex(int index) {
|
void playIndex(int index, {List<Int64>? subId}) {
|
||||||
if (index == this.index) return;
|
if (index == this.index && subId == null) return;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
final audioItem = playlist![index];
|
final audioItem = playlist![index];
|
||||||
final item = audioItem.item;
|
final item = audioItem.item;
|
||||||
oid = item.oid;
|
oid = item.oid;
|
||||||
subId = item.subId;
|
this.subId = subId ?? item.subId;
|
||||||
itemType = item.itemType;
|
itemType = item.itemType;
|
||||||
_queryPlayUrl().then((res) {
|
_queryPlayUrl().then((res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
maxWidth: min(640, context.mediaQueryShortestSide),
|
maxWidth: min(640, context.mediaQueryShortestSide),
|
||||||
),
|
),
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final colorScheme = ColorScheme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
final colorScheme = theme.colorScheme;
|
||||||
return FractionallySizedBox(
|
return FractionallySizedBox(
|
||||||
heightFactor: !context.mediaQuerySize.isPortrait && Utils.isMobile
|
heightFactor: !context.mediaQuerySize.isPortrait && Utils.isMobile
|
||||||
? 1.0
|
? 1.0
|
||||||
@@ -177,6 +178,10 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
|
child: Theme(
|
||||||
|
data: theme.copyWith(
|
||||||
|
dividerColor: Colors.transparent,
|
||||||
|
),
|
||||||
child: refreshIndicator(
|
child: refreshIndicator(
|
||||||
onRefresh: () => _controller.loadPrev(context),
|
onRefresh: () => _controller.loadPrev(context),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
@@ -200,6 +205,109 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
}
|
}
|
||||||
final isCurr = index == _controller.index;
|
final isCurr = index == _controller.index;
|
||||||
final item = playlist[index];
|
final item = playlist[index];
|
||||||
|
if (item.parts.length > 1) {
|
||||||
|
final subId = _controller.subId.firstOrNull;
|
||||||
|
return ExpansionTile(
|
||||||
|
dense: true,
|
||||||
|
minTileHeight: 45,
|
||||||
|
initiallyExpanded: isCurr,
|
||||||
|
collapsedIconColor: isCurr
|
||||||
|
? colorScheme.primary
|
||||||
|
: null,
|
||||||
|
iconColor: isCurr
|
||||||
|
? null
|
||||||
|
: colorScheme.onSurfaceVariant,
|
||||||
|
controlAffinity:
|
||||||
|
ListTileControlAffinity.leading,
|
||||||
|
title: Text(
|
||||||
|
item.arc.title,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: isCurr
|
||||||
|
? TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: colorScheme.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)
|
||||||
|
: const TextStyle(fontSize: 14),
|
||||||
|
),
|
||||||
|
trailing: isCurr
|
||||||
|
? null
|
||||||
|
: iconButton(
|
||||||
|
icon: const Icon(Icons.clear),
|
||||||
|
onPressed: () {
|
||||||
|
if (index <
|
||||||
|
_controller.index!) {
|
||||||
|
_controller.index -= 1;
|
||||||
|
}
|
||||||
|
_controller.playlist!.removeAt(
|
||||||
|
index,
|
||||||
|
);
|
||||||
|
(context as Element)
|
||||||
|
.markNeedsBuild();
|
||||||
|
},
|
||||||
|
iconColor: colorScheme.outline,
|
||||||
|
size: 28,
|
||||||
|
iconSize: 18,
|
||||||
|
),
|
||||||
|
children: item.parts.map((e) {
|
||||||
|
final isCurr = e.subId == subId;
|
||||||
|
return ListTile(
|
||||||
|
dense: true,
|
||||||
|
minTileHeight: 45,
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsetsDirectional.only(
|
||||||
|
start: 56.0,
|
||||||
|
end: 24.0,
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
if (!isCurr) {
|
||||||
|
_controller.playIndex(
|
||||||
|
index,
|
||||||
|
subId: [e.subId],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: Text.rich(
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: isCurr
|
||||||
|
? TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: colorScheme.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)
|
||||||
|
: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: colorScheme
|
||||||
|
.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
children: [
|
||||||
|
if (isCurr) ...[
|
||||||
|
WidgetSpan(
|
||||||
|
alignment:
|
||||||
|
PlaceholderAlignment
|
||||||
|
.bottom,
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/live.gif',
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
color:
|
||||||
|
colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const TextSpan(text: ' '),
|
||||||
|
],
|
||||||
|
TextSpan(text: e.title),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
return ListTile(
|
return ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
minTileHeight: 45,
|
minTileHeight: 45,
|
||||||
@@ -214,20 +322,11 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: isCurr
|
style: isCurr
|
||||||
? TextStyle(
|
? TextStyle(
|
||||||
height: 1,
|
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: colorScheme.primary,
|
color: colorScheme.primary,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
)
|
)
|
||||||
: const TextStyle(
|
: const TextStyle(fontSize: 14),
|
||||||
height: 1,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
strutStyle: const StrutStyle(
|
|
||||||
height: 1,
|
|
||||||
leading: 0,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
if (isCurr) ...[
|
if (isCurr) ...[
|
||||||
@@ -276,6 +375,7 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Divider(
|
Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: colorScheme.outline.withValues(alpha: 0.1),
|
color: colorScheme.outline.withValues(alpha: 0.1),
|
||||||
|
|||||||
@@ -291,7 +291,10 @@ class _ReplyPageState extends CommonRichTextPubPageState<ReplyPage> {
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: const TextStyle(fontSize: 13),
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: theme.colorScheme.onSurface,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user