mod: 合集布局
This commit is contained in:
@ -65,6 +65,45 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildPageListItem(
|
||||||
|
EpisodeItem page,
|
||||||
|
int index,
|
||||||
|
bool isCurrentIndex,
|
||||||
|
) {
|
||||||
|
Color primary = Theme.of(context).colorScheme.primary;
|
||||||
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
setState(() {
|
||||||
|
changeFucCall(page, index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dense: false,
|
||||||
|
leading: isCurrentIndex
|
||||||
|
? Image.asset(
|
||||||
|
'assets/images/live.gif',
|
||||||
|
color: primary,
|
||||||
|
height: 12,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
title: Text(
|
||||||
|
'第${index + 1}话 ${page.longTitle!}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: isCurrentIndex
|
||||||
|
? primary
|
||||||
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: page.badge != null
|
||||||
|
? Image.asset(
|
||||||
|
'assets/images/big-vip.png',
|
||||||
|
height: 20,
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void showBangumiPanel() {
|
void showBangumiPanel() {
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -106,37 +145,21 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
itemBuilder: (BuildContext context, int index) =>
|
itemBuilder: (BuildContext context, int index) {
|
||||||
ListTile(
|
bool isLastItem = index == widget.pages.length - 1;
|
||||||
onTap: () {
|
bool isCurrentIndex = currentIndex == index;
|
||||||
setState(() {
|
return isLastItem
|
||||||
changeFucCall(widget.pages[index], index);
|
? SizedBox(
|
||||||
});
|
height:
|
||||||
},
|
MediaQuery.of(context).padding.bottom +
|
||||||
dense: false,
|
20,
|
||||||
leading: index == currentIndex
|
|
||||||
? Image.asset(
|
|
||||||
'assets/images/live.gif',
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
height: 12,
|
|
||||||
)
|
)
|
||||||
: null,
|
: buildPageListItem(
|
||||||
title: Text(
|
widget.pages[index],
|
||||||
'第${index + 1}话 ${widget.pages[index].longTitle!}',
|
index,
|
||||||
style: TextStyle(
|
isCurrentIndex,
|
||||||
fontSize: 14,
|
);
|
||||||
color: index == currentIndex
|
},
|
||||||
? Theme.of(context).colorScheme.primary
|
|
||||||
: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
trailing: widget.pages[index].badge != null
|
|
||||||
? Image.asset(
|
|
||||||
'assets/images/big-vip.png',
|
|
||||||
height: 20,
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
),
|
|
||||||
itemScrollController: itemScrollController,
|
itemScrollController: itemScrollController,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -56,6 +56,37 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildEpisodeListItem(
|
||||||
|
Part episode,
|
||||||
|
int index,
|
||||||
|
bool isCurrentIndex,
|
||||||
|
) {
|
||||||
|
Color primary = Theme.of(context).colorScheme.primary;
|
||||||
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
|
changeFucCall(episode, index);
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
dense: false,
|
||||||
|
leading: isCurrentIndex
|
||||||
|
? Image.asset(
|
||||||
|
'assets/images/live.gif',
|
||||||
|
color: primary,
|
||||||
|
height: 12,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
title: Text(
|
||||||
|
episode.pagePart!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: isCurrentIndex
|
||||||
|
? primary
|
||||||
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
@ -131,39 +162,25 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
itemCount: episodes.length,
|
itemCount: episodes.length + 1,
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return ListTile(
|
bool isLastItem =
|
||||||
onTap: () {
|
index == episodes.length;
|
||||||
changeFucCall(
|
bool isCurrentIndex =
|
||||||
episodes[index], index);
|
currentIndex == index;
|
||||||
Get.back();
|
return isLastItem
|
||||||
},
|
? SizedBox(
|
||||||
dense: false,
|
height: MediaQuery.of(context)
|
||||||
leading: index == currentIndex
|
.padding
|
||||||
? Image.asset(
|
.bottom +
|
||||||
'assets/images/live.gif',
|
20,
|
||||||
color: Theme.of(context)
|
)
|
||||||
.colorScheme
|
: buildEpisodeListItem(
|
||||||
.primary,
|
episodes[index],
|
||||||
height: 12,
|
index,
|
||||||
)
|
isCurrentIndex,
|
||||||
: null,
|
);
|
||||||
title: Text(
|
|
||||||
episodes[index].pagePart!,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: index == currentIndex
|
|
||||||
? Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary
|
|
||||||
: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -192,6 +209,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
itemExtent: 150,
|
itemExtent: 150,
|
||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
|
bool isCurrentIndex = currentIndex == i;
|
||||||
return Container(
|
return Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
margin: const EdgeInsets.only(right: 10),
|
margin: const EdgeInsets.only(right: 10),
|
||||||
@ -206,7 +224,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
vertical: 8, horizontal: 8),
|
vertical: 8, horizontal: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (i == currentIndex) ...<Widget>[
|
if (isCurrentIndex) ...<Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/live.gif',
|
'assets/images/live.gif',
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
@ -220,7 +238,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
color: i == currentIndex
|
color: isCurrentIndex
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.onSurface),
|
: Theme.of(context).colorScheme.onSurface),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
@ -80,6 +80,34 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
super.dispose();
|
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.gif',
|
||||||
|
color: primary,
|
||||||
|
height: 12,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
title: Text(
|
||||||
|
episode.title!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: isCurrentIndex
|
||||||
|
? primary
|
||||||
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Builder(builder: (BuildContext context) {
|
return Builder(builder: (BuildContext context) {
|
||||||
@ -134,32 +162,22 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: episodes.length,
|
itemCount: episodes.length,
|
||||||
itemBuilder: (BuildContext context, int index) =>
|
itemBuilder: (BuildContext context, int index) {
|
||||||
ListTile(
|
bool isLastItem = index == episodes.length - 1;
|
||||||
onTap: () =>
|
bool isCurrentIndex = currentIndex == index;
|
||||||
changeFucCall(episodes[index], index),
|
return isLastItem
|
||||||
dense: false,
|
? SizedBox(
|
||||||
leading: index == currentIndex
|
height: MediaQuery.of(context)
|
||||||
? Image.asset(
|
.padding
|
||||||
'assets/images/live.gif',
|
.bottom +
|
||||||
color: Theme.of(context)
|
20,
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
height: 12,
|
|
||||||
)
|
)
|
||||||
: null,
|
: buildEpisodeListItem(
|
||||||
title: Text(
|
episodes[index],
|
||||||
episodes[index].title!,
|
index,
|
||||||
style: TextStyle(
|
isCurrentIndex,
|
||||||
fontSize: 14,
|
);
|
||||||
color: index == currentIndex
|
},
|
||||||
? Theme.of(context).colorScheme.primary
|
|
||||||
: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
itemScrollController: itemScrollController,
|
itemScrollController: itemScrollController,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user