Revert "chore: clean up"

This reverts commit 538494b7ec.
This commit is contained in:
bggRGjQaUbCoE
2025-04-20 18:04:06 +08:00
parent a5c7ec0d60
commit 6f4321ae14
90 changed files with 1814 additions and 493 deletions

View File

@@ -68,8 +68,24 @@ class _BangumiPanelState extends State<BangumiPanel> {
super.dispose();
}
// void changeFucCall(item, i) async {
// if (item.badge != null && item.badge == '会员' && vipStatus != 1) {
// SmartDialog.showToast('需要大会员');
// return;
// }
// await widget.changeFuc!(
// item.bvid,
// item.cid,
// item.aid,
// );
// currentIndex = i;
// setState(() {});
// scrollToIndex();
// }
void scrollToIndex() {
WidgetsBinding.instance.addPostFrameCallback((_) {
// 在回调函数中获取更新后的状态
listViewScrollCtr.animateTo(
(currentIndex * 150.0).clamp(listViewScrollCtr.position.minScrollExtent,
listViewScrollCtr.position.maxScrollExtent),
@@ -132,12 +148,11 @@ class _BangumiPanelState extends State<BangumiPanel> {
scrollDirection: Axis.horizontal,
itemCount: widget.pages.length,
itemExtent: 150,
itemBuilder: (BuildContext context, int index) {
final item = widget.pages[index];
itemBuilder: (BuildContext context, int i) {
return Container(
width: 150,
margin: EdgeInsets.only(
right: index == widget.pages.length - 1 ? 0 : 10,
right: i == widget.pages.length - 1 ? 0 : 10,
),
child: Material(
color: Theme.of(context).colorScheme.onInverseSurface,
@@ -145,19 +160,24 @@ class _BangumiPanelState extends State<BangumiPanel> {
clipBehavior: Clip.hardEdge,
child: InkWell(
onTap: () {
if (item.badge != null &&
item.badge == '会员' &&
if (widget.pages[i].badge != null &&
widget.pages[i].badge == '会员' &&
vipStatus != 1) {
SmartDialog.showToast('需要大会员');
// return;
}
widget.changeFuc(
item.epId,
item.bvid,
item.cid,
item.aid,
item.cover,
widget.pages[i].epId,
widget.pages[i].bvid,
widget.pages[i].cid,
widget.pages[i].aid,
widget.pages[i].cover,
);
// currentIndex = i;
// setState(() {});
// scrollToIndex();
},
//changeFucCall(widget.pages[i], i),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 10),
@@ -166,7 +186,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
children: <Widget>[
Row(
children: [
if (index == currentIndex) ...<Widget>[
if (i == currentIndex) ...<Widget>[
Image.asset(
'assets/images/live.png',
color: Theme.of(context).colorScheme.primary,
@@ -177,32 +197,32 @@ class _BangumiPanelState extends State<BangumiPanel> {
],
Expanded(
child: Text(
item.title ?? '${index + 1}',
maxLines: (item.longTitle != null &&
item.longTitle != '')
widget.pages[i].title ?? '${i + 1}',
maxLines: (widget.pages[i].longTitle != null &&
widget.pages[i].longTitle != '')
? 1
: 2,
style: TextStyle(
fontSize: 13,
color: index == currentIndex
color: i == currentIndex
? Theme.of(context).colorScheme.primary
: Theme.of(context)
.colorScheme
.onSurface),
)),
const SizedBox(width: 2),
if (item.badge != null) ...[
if (widget.pages[i].badge != null) ...[
const Spacer(),
if (item.badge == '会员') ...[
if (widget.pages[i].badge == '会员') ...[
Image.asset(
'assets/images/big-vip.png',
height: 16,
semanticLabel: "大会员",
),
],
if (item.badge != '会员') ...[
if (widget.pages[i].badge != '会员') ...[
Text(
item.badge!,
widget.pages[i].badge!,
style: TextStyle(
fontSize: 11,
color:
@@ -213,15 +233,15 @@ class _BangumiPanelState extends State<BangumiPanel> {
]
],
),
if (item.longTitle != null &&
item.longTitle != '') ...[
if (widget.pages[i].longTitle != null &&
widget.pages[i].longTitle != '') ...[
const SizedBox(height: 3),
Text(
item.longTitle!,
widget.pages[i].longTitle!,
maxLines: 1,
style: TextStyle(
fontSize: 13,
color: index == currentIndex
color: i == currentIndex
? Theme.of(context).colorScheme.primary
: Theme.of(context)
.colorScheme