mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-22 03:31:09 +08:00
@@ -7,9 +7,11 @@ import 'package:PiliPlus/pages/search_panel/pgc/widgets/item.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/user/widgets/item.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/view.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/waterfall.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:waterfall_flow/waterfall_flow.dart';
|
||||
import 'package:waterfall_flow/waterfall_flow.dart'
|
||||
hide SliverWaterfallFlowDelegateWithMaxCrossAxisExtent;
|
||||
|
||||
class SearchAllPanel extends CommonSearchPanel {
|
||||
const SearchAllPanel({
|
||||
@@ -37,63 +39,59 @@ class _SearchAllPanelState
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme, List<dynamic> list) {
|
||||
return SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
lastChildLayoutTypeBuilder: (index) {
|
||||
if (index == list.length - 1) {
|
||||
controller.onLoadMore();
|
||||
}
|
||||
return index == list.length
|
||||
? LastChildLayoutType.foot
|
||||
: LastChildLayoutType.none;
|
||||
},
|
||||
children: list
|
||||
.map(
|
||||
(item) => switch (item) {
|
||||
SearchVideoItemModel() => SizedBox(
|
||||
height: 120,
|
||||
child: VideoCardH(videoItem: item),
|
||||
),
|
||||
List<SearchPgcItemModel>() =>
|
||||
item.length == 1
|
||||
? SizedBox(
|
||||
height: 160,
|
||||
child: SearchPgcItem(item: item.first),
|
||||
)
|
||||
: SizedBox(
|
||||
height:
|
||||
Grid.smallCardWidth / 2 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(60),
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 7),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: item.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: Grid.smallCardWidth / 2,
|
||||
margin: EdgeInsets.only(
|
||||
left: StyleString.safeSpace,
|
||||
right: index == item.length - 1
|
||||
? StyleString.safeSpace
|
||||
: 0,
|
||||
),
|
||||
child: PgcCardVSearch(item: item[index]),
|
||||
);
|
||||
},
|
||||
),
|
||||
return SliverWaterfallFlow(
|
||||
gridDelegate: SliverWaterfallFlowDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) {
|
||||
if (index == list.length - 1) {
|
||||
controller.onLoadMore();
|
||||
}
|
||||
return switch (list[index]) {
|
||||
SearchVideoItemModel e => SizedBox(
|
||||
height: 120,
|
||||
child: VideoCardH(videoItem: e),
|
||||
),
|
||||
List<SearchPgcItemModel> e =>
|
||||
e.length == 1
|
||||
? SizedBox(
|
||||
height: 160,
|
||||
child: SearchPgcItem(item: e.first),
|
||||
)
|
||||
: SizedBox(
|
||||
height:
|
||||
Grid.smallCardWidth / 2 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(60),
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 7),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: e.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: Grid.smallCardWidth / 2,
|
||||
margin: EdgeInsets.only(
|
||||
left: StyleString.safeSpace,
|
||||
right: index == e.length - 1
|
||||
? StyleString.safeSpace
|
||||
: 0,
|
||||
),
|
||||
child: PgcCardVSearch(item: e[index]),
|
||||
);
|
||||
},
|
||||
),
|
||||
SearchUserItemModel() => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: SearchUserItem(
|
||||
item: item,
|
||||
),
|
||||
),
|
||||
_ => const SizedBox.shrink(),
|
||||
},
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
SearchUserItemModel e => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: SearchUserItem(item: e),
|
||||
),
|
||||
_ => const SizedBox.shrink(),
|
||||
};
|
||||
},
|
||||
childCount: list.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user