fix: Fixed focus issue

This commit is contained in:
Deven Joshi
2021-01-18 20:04:48 +05:30
parent 57375a4df8
commit 623b6f0c76
2 changed files with 14 additions and 2 deletions
@@ -156,6 +156,9 @@ class _HomePageState extends State<HomePage> {
onNewChatButtonTap: () {
Navigator.pushNamed(context, Routes.NEW_CHAT);
},
preNavigationCallback: () {
FocusScope.of(context).requestFocus(FocusNode());
},
),
drawer: _buildDrawer(context, user),
drawerEdgeDragWidth: 50,
@@ -519,6 +522,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
);
},
onItemTap: (messageResponse) async {
FocusScope.of(context).requestFocus(FocusNode());
final client = StreamChat.of(context).client;
final message = messageResponse.message;
final channel = client.channel(
@@ -55,6 +55,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
this.onUserAvatarTap,
this.onNewChatButtonTap,
this.showConnectionStateTile = false,
this.preNavigationCallback,
}) : super(key: key);
/// Pass this if you don't have a [Client] in your widget tree.
@@ -72,6 +73,8 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
final bool showConnectionStateTile;
final VoidCallback preNavigationCallback;
@override
Widget build(BuildContext context) {
final _client = client ?? StreamChat.of(context).client;
@@ -110,8 +113,13 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
child: UserAvatar(
user: user,
showOnlineStatus: false,
onTap:
onUserAvatarTap ?? (_) => Scaffold.of(context).openDrawer(),
onTap: onUserAvatarTap ??
(_) {
if (preNavigationCallback != null) {
preNavigationCallback();
}
Scaffold.of(context).openDrawer();
},
borderRadius: BorderRadius.circular(20),
constraints: BoxConstraints.tightFor(
height: 40,