mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: medialist desc
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -33,7 +33,7 @@ class MediaListPanel extends StatefulWidget {
|
|||||||
final Function getBvId;
|
final Function getBvId;
|
||||||
final VoidCallback loadMoreMedia;
|
final VoidCallback loadMoreMedia;
|
||||||
final int? count;
|
final int? count;
|
||||||
final bool? desc;
|
final bool desc;
|
||||||
final VoidCallback onReverse;
|
final VoidCallback onReverse;
|
||||||
final Function? loadPrevious;
|
final Function? loadPrevious;
|
||||||
|
|
||||||
@@ -43,10 +43,12 @@ class MediaListPanel extends StatefulWidget {
|
|||||||
|
|
||||||
class _MediaListPanelState extends State<MediaListPanel> {
|
class _MediaListPanelState extends State<MediaListPanel> {
|
||||||
final _scrollController = ItemScrollController();
|
final _scrollController = ItemScrollController();
|
||||||
|
late RxBool desc;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
desc = widget.desc.obs;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
int index =
|
int index =
|
||||||
widget.mediaList.indexWhere((item) => item.bvid == widget.getBvId());
|
widget.mediaList.indexWhere((item) => item.bvid == widget.getBvId());
|
||||||
@@ -72,14 +74,18 @@ class _MediaListPanelState extends State<MediaListPanel> {
|
|||||||
titleSpacing: 16,
|
titleSpacing: 16,
|
||||||
title: Text(widget.panelTitle ?? '稍后再看'),
|
title: Text(widget.panelTitle ?? '稍后再看'),
|
||||||
actions: [
|
actions: [
|
||||||
if (widget.desc != null)
|
Obx(
|
||||||
mediumButton(
|
() => mediumButton(
|
||||||
tooltip: widget.desc == true ? '顺序播放' : '倒序播放',
|
tooltip: desc.value ? '顺序播放' : '倒序播放',
|
||||||
icon: widget.desc == true
|
icon: desc.value
|
||||||
? MdiIcons.sortAscending
|
? MdiIcons.sortAscending
|
||||||
: MdiIcons.sortDescending,
|
: MdiIcons.sortDescending,
|
||||||
onPressed: widget.onReverse,
|
onPressed: () {
|
||||||
|
widget.onReverse();
|
||||||
|
desc.value = !desc.value;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
mediumButton(
|
mediumButton(
|
||||||
tooltip: '关闭',
|
tooltip: '关闭',
|
||||||
icon: Icons.close,
|
icon: Icons.close,
|
||||||
|
|||||||
Reference in New Issue
Block a user