🧪 Post max width

This commit is contained in:
LittleSheep 2025-01-19 17:20:24 +08:00
parent 9698ca53e4
commit ed7981fdaf

View File

@ -217,27 +217,48 @@ 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 GestureDetector( return Center(
child: PostItem( child: Container(
data: _posts[idx], decoration: BoxDecoration(
maxWidth: 640, border: Border(
onChanged: (data) { left: BorderSide(
setState(() => _posts[idx] = data); color: Theme.of(context).dividerColor,
}, width: 1 / MediaQuery.of(context).devicePixelRatio,
onDeleted: () { ),
_refreshPosts(); right: BorderSide(
}, color: Theme.of(context).dividerColor,
width: 1 / MediaQuery.of(context).devicePixelRatio,
),
),
),
constraints: const BoxConstraints(maxWidth: 640),
child: Column(
children: [
GestureDetector(
child: PostItem(
data: _posts[idx],
maxWidth: 640,
onChanged: (data) {
setState(() => _posts[idx] = data);
},
onDeleted: () {
_refreshPosts();
},
),
onTap: () {
GoRouter.of(context).pushNamed(
'postDetail',
pathParameters: {'slug': _posts[idx].id.toString()},
extra: _posts[idx],
);
},
),
const Divider(height: 1),
],
),
), ),
onTap: () {
GoRouter.of(context).pushNamed(
'postDetail',
pathParameters: {'slug': _posts[idx].id.toString()},
extra: _posts[idx],
);
},
); );
}, },
separatorBuilder: (context, index) => const Divider(height: 1),
), ),
], ],
), ),