mod: 合集布局

This commit is contained in:
guozhigq
2024-03-03 00:15:16 +08:00
committed by orz12
parent b6f9e14a4b
commit 7abcb3dc1b
3 changed files with 152 additions and 93 deletions

View File

@@ -84,6 +84,35 @@ class _SeasonPanelState extends State<SeasonPanel> {
super.dispose();
}
Widget buildEpisodeListItem(
EpisodeItem episode,
int index,
bool isCurrentIndex,
) {
Color primary = Theme.of(context).colorScheme.primary;
return ListTile(
onTap: () => changeFucCall(episode, index),
dense: false,
leading: isCurrentIndex
? Image.asset(
'assets/images/live.png',
color: primary,
height: 12,
semanticLabel: "正在播放:",
)
: null,
title: Text(
episode.title!,
style: TextStyle(
fontSize: 14,
color: isCurrentIndex
? primary
: Theme.of(context).colorScheme.onSurface,
),
),
);
}
@override
Widget build(BuildContext context) {
if (episodes == null) {
@@ -144,34 +173,23 @@ class _SeasonPanelState extends State<SeasonPanel> {
bottom: MediaQuery.of(context).padding.bottom),
child: Material(
child: ScrollablePositionedList.builder(
itemCount: episodes!.length,
itemBuilder: (BuildContext context, int index) =>
ListTile(
onTap: () =>
changeFucCall(episodes![index], index),
dense: false,
leading: index == currentIndex
? Image.asset(
'assets/images/live.png',
color: Theme.of(context)
.colorScheme
.primary,
height: 12,
semanticLabel: "正在播放:",
itemCount: episodes.length,
itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == episodes.length - 1;
bool isCurrentIndex = currentIndex == index;
return isLastItem
? SizedBox(
height: MediaQuery.of(context)
.padding
.bottom +
20,
)
: null,
title: Text(
episodes![index].title!,
style: TextStyle(
fontSize: 14,
color: index == currentIndex
? Theme.of(context).colorScheme.primary
: Theme.of(context)
.colorScheme
.onSurface,
),
),
),
: buildEpisodeListItem(
episodes[index],
index,
isCurrentIndex,
);
},
itemScrollController: itemScrollController,
),
),