diff --git a/lib/screens/channel/chat/chat.dart b/lib/screens/channel/chat/chat.dart index 53d4f5f0..33268684 100644 --- a/lib/screens/channel/chat/chat.dart +++ b/lib/screens/channel/chat/chat.dart @@ -39,7 +39,7 @@ class Chat extends StatelessWidget { if (message.user != null && message.user != chatStore.auth.user.details?.login) { return InkWell( onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); + FocusScope.of(context).unfocus(); if (chatStore.assetsStore.showEmoteMenu) chatStore.assetsStore.showEmoteMenu = false; }, onLongPress: () => showModalBottomSheet( diff --git a/lib/screens/channel/chat/details/chat_details.dart b/lib/screens/channel/chat/details/chat_details.dart index e3534bfe..a198bf73 100644 --- a/lib/screens/channel/chat/details/chat_details.dart +++ b/lib/screens/channel/chat/details/chat_details.dart @@ -17,7 +17,7 @@ class ChatDetails extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( - onTap: FocusManager.instance.primaryFocus?.unfocus, + onTap: FocusScope.of(context).unfocus, child: SafeArea( child: Observer( builder: (_) => Column( diff --git a/lib/screens/channel/chat/details/chat_users_list.dart b/lib/screens/channel/chat/details/chat_users_list.dart index d9f84c21..b7a2f232 100644 --- a/lib/screens/channel/chat/details/chat_users_list.dart +++ b/lib/screens/channel/chat/details/chat_users_list.dart @@ -69,9 +69,9 @@ class _ChattersListState extends State { suffixIcon: IconButton( tooltip: 'Clear Filter', onPressed: () { + FocusScope.of(context).unfocus(); chatDetailStore.filterText = ''; _textController.clear(); - FocusManager.instance.primaryFocus?.unfocus(); }, icon: const Icon(Icons.clear), ), diff --git a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart index 30f1a7a8..046e1fdf 100644 --- a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart +++ b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart @@ -46,7 +46,7 @@ class ChatBottomBar extends StatelessWidget { tooltip: 'Emote Menu', icon: const Icon(Icons.emoji_emotions_outlined), onPressed: () { - FocusManager.instance.primaryFocus?.unfocus(); + FocusScope.of(context).unfocus(); chatStore.assetsStore.showEmoteMenu = !chatStore.assetsStore.showEmoteMenu; }, ), diff --git a/lib/screens/channel/video_chat.dart b/lib/screens/channel/video_chat.dart index 34f11a09..58d3d5cd 100644 --- a/lib/screens/channel/video_chat.dart +++ b/lib/screens/channel/video_chat.dart @@ -56,12 +56,8 @@ class _VideoChatState extends State { onTap: () { if (chatStore.assetsStore.showEmoteMenu) { chatStore.assetsStore.showEmoteMenu = false; - } else { - if (chatStore.textFieldFocusNode.hasFocus) { - chatStore.textFieldFocusNode.unfocus(); - } else { - videoStore.handleVideoTap(); - } + } else if (chatStore.textFieldFocusNode.hasFocus) { + chatStore.textFieldFocusNode.unfocus(); } }, child: Chat( diff --git a/lib/screens/home/home.dart b/lib/screens/home/home.dart index 6dac8f92..711c1d42 100644 --- a/lib/screens/home/home.dart +++ b/lib/screens/home/home.dart @@ -33,7 +33,7 @@ class Home extends StatelessWidget { final authStore = context.read(); return GestureDetector( - onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + onTap: FocusScope.of(context).unfocus, child: Scaffold( appBar: AppBar( centerTitle: false, diff --git a/lib/screens/home/search/search.dart b/lib/screens/home/search/search.dart index e4fbed28..93874ffd 100644 --- a/lib/screens/home/search/search.dart +++ b/lib/screens/home/search/search.dart @@ -40,10 +40,10 @@ class _SearchState extends State { suffixIcon: IconButton( tooltip: 'Clear Search', onPressed: () { + FocusScope.of(context).unfocus(); setState(() { textEditingController.clear(); }); - FocusManager.instance.primaryFocus?.unfocus(); }, icon: const Icon(Icons.clear), ),