Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-14 12:13:17 +08:00
parent 025775d231
commit 09be4f45f0
78 changed files with 428 additions and 849 deletions

View File

@@ -81,11 +81,7 @@ class _FavSortPageState extends State<FavSortPage> with ReorderMixin {
);
}
void onReorder(int oldIndex, int newIndex) {
if (newIndex > oldIndex) {
newIndex -= 1;
}
void onReorderItem(int oldIndex, int newIndex) {
final oldItem = sortList[oldIndex];
final newItem = sortList.getOrNull(
oldIndex > newIndex ? newIndex - 1 : newIndex, // might be Negative
@@ -94,15 +90,14 @@ class _FavSortPageState extends State<FavSortPage> with ReorderMixin {
'${newItem == null ? '0:0' : '${newItem.id}:${newItem.type}'}:${oldItem.id}:${oldItem.type}',
);
final tabsItem = sortList.removeAt(oldIndex);
sortList.insert(newIndex, tabsItem);
sortList.insert(newIndex, sortList.removeAt(oldIndex));
setState(() {});
}
Widget get _buildBody {
final child = ReorderableListView.builder(
onReorder: onReorder,
onReorderItem: onReorderItem,
proxyDecorator: proxyDecorator,
physics: const AlwaysScrollableScrollPhysics(),
padding:
@@ -113,7 +108,7 @@ class _FavSortPageState extends State<FavSortPage> with ReorderMixin {
final item = sortList[index];
return SizedBox(
key: ValueKey(item.id),
height: 98,
height: 110,
child: FavVideoCardH(item: item),
);
},