🐛 Fix search post did not triggered

This commit is contained in:
LittleSheep 2024-12-22 20:28:53 +08:00
parent 7a3ab6fd7d
commit 3eda464e03

View File

@ -99,11 +99,16 @@ class _PostSearchScreenState extends State<PostSearchScreen> {
],
).padding(horizontal: 24, vertical: 16),
).then((_) {
_posts.clear();
_fetchPosts();
_refreshPosts();
});
}
Future<void> _refreshPosts() {
_postCount = null;
_posts.clear();
return _fetchPosts();
}
@override
Widget build(BuildContext context) {
const labelShadows = <Shadow>[
@ -144,8 +149,7 @@ class _PostSearchScreenState extends State<PostSearchScreen> {
setState(() => _posts[idx] = data);
},
onDeleted: () {
_posts.clear();
_fetchPosts();
_refreshPosts();
},
),
onTap: () {
@ -176,10 +180,8 @@ class _PostSearchScreenState extends State<PostSearchScreen> {
_searchTerm = value;
},
onSubmitted: (value) {
setState(() => _posts.clear());
_searchTerm = value;
_fetchPosts();
_refreshPosts();
},
),
if (_lastTook != null)