mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-09 10:40:12 +08:00
@@ -76,36 +76,13 @@ class _DynamicsTabPageState extends State<DynamicsTabPage>
|
||||
? SliverWaterfallFlow(
|
||||
gridDelegate: dynGridDelegate,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) {
|
||||
if (index == response.length - 1) {
|
||||
controller.onLoadMore();
|
||||
}
|
||||
final item = response[index];
|
||||
return DynamicPanel(
|
||||
item: item,
|
||||
onRemove: (idStr) =>
|
||||
controller.onRemove(index, idStr),
|
||||
onBlock: () => controller.onBlock(index),
|
||||
onUnfold: () => controller.onUnfold(item, index),
|
||||
);
|
||||
},
|
||||
(_, index) => _itemBuilder(response, index),
|
||||
childCount: response.length,
|
||||
),
|
||||
)
|
||||
: SliverList.builder(
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
controller.onLoadMore();
|
||||
}
|
||||
final item = response[index];
|
||||
return DynamicPanel(
|
||||
item: item,
|
||||
onRemove: (idStr) =>
|
||||
controller.onRemove(index, idStr),
|
||||
onBlock: () => controller.onBlock(index),
|
||||
onUnfold: () => controller.onUnfold(item, index),
|
||||
);
|
||||
},
|
||||
itemBuilder: (context, index) =>
|
||||
_itemBuilder(response, index),
|
||||
itemCount: response.length,
|
||||
)
|
||||
: HttpError(onReload: controller.onReload),
|
||||
@@ -115,4 +92,17 @@ class _DynamicsTabPageState extends State<DynamicsTabPage>
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
Widget _itemBuilder(List<DynamicItemModel> list, int index) {
|
||||
if (index == list.length - 1) {
|
||||
controller.onLoadMore();
|
||||
}
|
||||
final item = list[index];
|
||||
return DynamicPanel(
|
||||
item: item,
|
||||
onRemove: (idStr) => controller.onRemove(index, idStr),
|
||||
onBlock: () => controller.onBlock(index),
|
||||
onUnfold: () => controller.onUnfold(item, index),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user