fix: 番剧集数错误、合集最后一集不显示

This commit is contained in:
orz12
2024-03-07 10:54:55 +08:00
parent e2651f3c82
commit cad2a66556
2 changed files with 12 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
) )
: null, : null,
title: Text( title: Text(
'${index + 1}${page.longTitle!}', '' + (page.title ?? '${index + 1}') + '${page.longTitle!}',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: isCurrentIndex color: isCurrentIndex
@@ -96,13 +96,13 @@ class _BangumiPanelState extends State<BangumiPanel> {
: Theme.of(context).colorScheme.onSurface, : Theme.of(context).colorScheme.onSurface,
), ),
), ),
trailing: page.badge != null trailing: page.badge != null && page.badge == '会员'
? Image.asset( ? Image.asset(
'assets/images/big-vip.png', 'assets/images/big-vip.png',
height: 20, height: 20,
semanticLabel: "大会员", semanticLabel: "大会员",
) )
: const SizedBox(), : Text(page.badge ?? ""),
); );
} }
@@ -147,15 +147,15 @@ class _BangumiPanelState extends State<BangumiPanel> {
Expanded( Expanded(
child: Material( child: Material(
child: ScrollablePositionedList.builder( child: ScrollablePositionedList.builder(
itemCount: widget.pages.length, itemCount: widget.pages.length + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == widget.pages.length - 1; bool isLastItem = index == widget.pages.length;
bool isCurrentIndex = currentIndex == index; bool isCurrentIndex = currentIndex == index;
return isLastItem return isLastItem
? SizedBox( ? SizedBox(
height: height:
MediaQuery.of(context).padding.bottom + MediaQuery.of(context).padding.bottom +
20, 50,
) )
: buildPageListItem( : buildPageListItem(
widget.pages[index], widget.pages[index],
@@ -271,7 +271,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
const SizedBox(width: 6) const SizedBox(width: 6)
], ],
Text( Text(
'${i + 1}', '' +
(widget.pages[i].title ?? "${i + 1}") +
'',
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: i == currentIndex color: i == currentIndex
@@ -282,6 +284,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
), ),
const SizedBox(width: 2), const SizedBox(width: 2),
if (widget.pages[i].badge != null) ...[ if (widget.pages[i].badge != null) ...[
const Spacer(),
if (widget.pages[i].badge == '会员') ...[ if (widget.pages[i].badge == '会员') ...[
Image.asset( Image.asset(
'assets/images/big-vip.png', 'assets/images/big-vip.png',
@@ -290,7 +293,6 @@ class _BangumiPanelState extends State<BangumiPanel> {
), ),
], ],
if (widget.pages[i].badge != '会员') ...[ if (widget.pages[i].badge != '会员') ...[
const Spacer(),
Text( Text(
widget.pages[i].badge!, widget.pages[i].badge!,
style: TextStyle( style: TextStyle(

View File

@@ -173,9 +173,9 @@ class _SeasonPanelState extends State<SeasonPanel> {
bottom: MediaQuery.of(context).padding.bottom), bottom: MediaQuery.of(context).padding.bottom),
child: Material( child: Material(
child: ScrollablePositionedList.builder( child: ScrollablePositionedList.builder(
itemCount: episodes!.length, itemCount: episodes!.length + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == episodes!.length - 1; bool isLastItem = index == episodes!.length;
bool isCurrentIndex = currentIndex == index; bool isCurrentIndex = currentIndex == index;
return isLastItem return isLastItem
? SizedBox( ? SizedBox(