🐛 Fix post shuffle

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

View File

@@ -36,46 +36,50 @@ 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) {
controller: cardSwiperController, if ((postListState.value?.items.length ?? 0) > 0) {
cardsCount: postListState.value!.items.length, return CardSwiper(
isLoop: false, controller: cardSwiperController,
cardBuilder: ( cardsCount: postListState.value!.items.length,
context, isLoop: false,
index, cardBuilder: (
horizontalOffsetPercentage, context,
verticalOffsetPercentage, index,
) { horizontalOffsetPercentage,
return Center( verticalOffsetPercentage,
child: ConstrainedBox( ) {
constraints: BoxConstraints(maxWidth: 540), return Center(
child: SingleChildScrollView( child: ConstrainedBox(
child: Card( constraints: BoxConstraints(maxWidth: 540),
margin: EdgeInsets.zero, child: SingleChildScrollView(
child: ClipRRect( child: Card(
borderRadius: const BorderRadius.all( margin: EdgeInsets.zero,
Radius.circular(8), child: ClipRRect(
), borderRadius: const BorderRadius.all(
child: PostActionableItem( Radius.circular(8),
item: postListState.value!.items[index], ),
), child: PostActionableItem(
item: postListState.value!.items[index],
), ),
), ),
), ),
), ),
); ),
}, );
onEnd: () { },
if (postListState.value?.hasMore ?? true) { onEnd: () async {
postListNotifier.fetch( if (postListState.value?.hasMore ?? true) {
cursor: postListState.value?.nextCursor, postListNotifier.forceRefresh();
); }
} },
}, );
) } else {
: Center(child: CircularProgressIndicator()), return Center(child: CircularProgressIndicator());
}
},
),
), ),
Positioned( Positioned(
left: 0, left: 0,