Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't scroll using arrow keys after we tap on dashchat #105

Open
KiraKami-dev opened this issue Jun 15, 2024 · 0 comments
Open

Can't scroll using arrow keys after we tap on dashchat #105

KiraKami-dev opened this issue Jun 15, 2024 · 0 comments

Comments

@KiraKami-dev
Copy link

KiraKami-dev commented Jun 15, 2024

When scrolling in the messages list i am facing an issue where when i tap on the dashChat widget the focus goes away meaning i can't scroll anymore.
I tried passing around the _focusNode.requestFocus() but it didn't seem to work as well.
It would be great if you could help me with this.

Below is an small code snippet :

Variable :

final ScrollController _scrollController = ScrollController();
  final FocusNode _focusNode = FocusNode();
Keyboard listener for arrow keys :

KeyboardListener(
          focusNode: _focusNode,
          autofocus: true,
          onKeyEvent: (event) {
            if (event is KeyDownEvent &&
                event.logicalKey == LogicalKeyboardKey.arrowUp) {
              print("Arrow up pressed");
              _scrollController.animateTo(_scrollController.offset + 100,
                  duration: Duration(milliseconds: 200),
                  curve: Curves.fastEaseInToSlowEaseOut);
            } else if (event is KeyDownEvent &&
                event.logicalKey == LogicalKeyboardKey.arrowDown) {
              print("Arrow down pressed");
              _scrollController.animateTo(_scrollController.offset - 100,
                  duration: Duration(milliseconds: 200),
                  curve: Curves.fastEaseInToSlowEaseOut);
            }
          },

Passing scroll to dashChat :

DashChat(
  typingUsers: botTyping,
  currentUser: myself,
  messages: allMessage,
  messageListOptions: MessageListOptions(
    scrollController: _scrollController,
    ),
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant