🐛 Fix post shuffle

This commit is contained in:
2025-09-06 23:00:26 +08:00
parent 9b68808c77
commit 1ce71f1fa1

View File

@@ -36,9 +36,11 @@ class PostShuffleScreen extends HookConsumerWidget {
bottom: bottom:
kBottomControlHeight + MediaQuery.of(context).padding.bottom, kBottomControlHeight + MediaQuery.of(context).padding.bottom,
), ),
child: child: Builder(
(postListState.value?.items.length ?? 0) > 0 key: ValueKey(postListState.value?.items.length ?? 0),
? CardSwiper( builder: (context) {
if ((postListState.value?.items.length ?? 0) > 0) {
return CardSwiper(
controller: cardSwiperController, controller: cardSwiperController,
cardsCount: postListState.value!.items.length, cardsCount: postListState.value!.items.length,
isLoop: false, isLoop: false,
@@ -67,15 +69,17 @@ class PostShuffleScreen extends HookConsumerWidget {
), ),
); );
}, },
onEnd: () { onEnd: () async {
if (postListState.value?.hasMore ?? true) { if (postListState.value?.hasMore ?? true) {
postListNotifier.fetch( postListNotifier.forceRefresh();
cursor: postListState.value?.nextCursor,
);
} }
}, },
) );
: Center(child: CircularProgressIndicator()), } else {
return Center(child: CircularProgressIndicator());
}
},
),
), ),
Positioned( Positioned(
left: 0, left: 0,