Skip to content

Commit 86da5e3

Browse files
committed
fix(post): hide keyboard when publish failed
1 parent 6d373b9 commit 86da5e3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/features/post/view/post_edit_page.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,11 @@ class _PostEditPageState extends State<PostEditPage> with LoggerMixin {
681681
}
682682

683683
Future<void> _onListen(BuildContext context, PostEditState state) async {
684-
if (state.status == PostEditStatus.failedToLoad) {
685-
showSnackBar(context: context, message: context.t.postEditPage.failedToLoadData);
686-
} else if (state.status == PostEditStatus.failedToUpload) {
684+
if (state.status == PostEditStatus.failedToUpload) {
687685
showSnackBar(context: context, message: state.errorText ?? context.t.general.failedToLoad);
686+
if (isMobile) {
687+
WidgetsBinding.instance.focusManager.primaryFocus?.unfocus();
688+
}
688689
} else if (state.status == PostEditStatus.success) {
689690
// Some action succeeded.
690691
if (widget.editType.isEditingPost) {

0 commit comments

Comments
 (0)