Skip to content

Commit

Permalink
改进滚动区
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhoucheng133 committed Aug 26, 2024
1 parent bde3a41 commit 20efb96
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions lib/pages/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ class _IndexState extends State<Index> {
child: RefreshIndicator(
onRefresh: ()=>initGet(context),
child: Obx(()=>
ListView.builder(
CustomScrollView(
controller: controller,
itemCount: ls.playList.length+6,
itemBuilder: (context, index){
if(index==0){
return const SizedBox(height: 15,);
}else if(index==1){
return SizedBox(
slivers: [
const SliverToBoxAdapter(
child: SizedBox(height: 15,),
),
SliverToBoxAdapter(
child: SizedBox(
height: 200,
child: ListView(
scrollDirection: Axis.horizontal,
Expand All @@ -256,12 +256,14 @@ class _IndexState extends State<Index> {
const SizedBox(width: 10,),
IndexPinItem(icon: Icons.album_rounded, label: '专辑', bgColor: Colors.blue[50]!, contentColor: Colors.blue, func: ()=>Get.to(()=>const Albums()),),
],
)
);
}else if(index==2){
return const SizedBox(height: 20,);
}else if(index==3){
return Row(
),
)
),
const SliverToBoxAdapter(
child: SizedBox(height: 20,),
),
SliverToBoxAdapter(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
Expand Down Expand Up @@ -300,17 +302,22 @@ class _IndexState extends State<Index> {
),
)
],
);
}else if(index==4){
return const SizedBox(height: 10,);
}else if(index==ls.playList.length+5){
return const SizedBox(height: 10,);
}
return Obx(()=>
PlayListItem(name: ls.playList[index-5]['name'], id: ls.playList[index-5]['id'], songCount: ls.playList[index-5]['songCount'], coverArt: ls.playList[index-5]['coverArt'])
);
}
),
),
),
const SliverToBoxAdapter(
child: SizedBox(height: 10,),
),
SliverList.builder(
itemCount: ls.playList.length,
itemBuilder: (context, index){
return PlayListItem(name: ls.playList[index]['name'], id: ls.playList[index]['id'], songCount: ls.playList[index]['songCount'], coverArt: ls.playList[index]['coverArt']);
}
),
const SliverToBoxAdapter(
child: SizedBox(height: 10,),
),
],
)
)
),
),
Expand Down

0 comments on commit 20efb96

Please sign in to comment.