🐛 Fix post item width issue

This commit is contained in:
LittleSheep 2025-02-11 21:35:53 +08:00
parent b3254e0f2f
commit 9b84e912b2
2 changed files with 36 additions and 36 deletions

View File

@ -261,8 +261,7 @@ class _ExploreScreenState extends State<ExploreScreen> {
hasReachedMax: _postCount != null && _posts.length >= _postCount!, hasReachedMax: _postCount != null && _posts.length >= _postCount!,
onFetchData: _fetchPosts, onFetchData: _fetchPosts,
itemBuilder: (context, idx) { itemBuilder: (context, idx) {
return Center( return OpenablePostItem(
child: OpenablePostItem(
data: _posts[idx], data: _posts[idx],
maxWidth: 640, maxWidth: 640,
onChanged: (data) { onChanged: (data) {
@ -271,7 +270,6 @@ class _ExploreScreenState extends State<ExploreScreen> {
onDeleted: () { onDeleted: () {
_refreshPosts(); _refreshPosts();
}, },
),
); );
}, },
separatorBuilder: (_, __) => const Gap(8), separatorBuilder: (_, __) => const Gap(8),

View File

@ -69,7 +69,8 @@ class OpenablePostItem extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final cfg = context.read<ConfigProvider>(); final cfg = context.read<ConfigProvider>();
return OpenContainer( return Center(
child: OpenContainer(
closedBuilder: (_, __) => Container( closedBuilder: (_, __) => Container(
constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity), constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity),
child: PostItem( child: PostItem(
@ -96,6 +97,7 @@ class OpenablePostItem extends StatelessWidget {
closedShape: const RoundedRectangleBorder( closedShape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16)), borderRadius: BorderRadius.all(Radius.circular(16)),
), ),
),
); );
} }
} }