0

I'm using Dash Chat 2 to build a small chat app in Flutter. When I set the extendBodyBehindAppBar parameter to true all the messages in the message list are moved up and I would like them not to shift up and to stay in place the same way they are when extendBodyBehindAppBar is false. Please see images and code below and thanks, this has been driving me crazy!

incorrect correct

The image on the left is incorrect and what happens when extendBodyBehindAppBar is true. The image on the right is correct but only displays this way when extendBodyBehindAppBar is false. I want to be able to extend the body behind the appbar but not have the message list shift upwards. My code is below.

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        title: const Text('Chat with Eric'),
        elevation: 0.0,
      ),
      extendBodyBehindAppBar: true, // *this causes the list to shift upwards the height of the appbar
      body: Container(        
        child: Padding(
          padding: const EdgeInsets.fromLTRB(10, 0, 10, 14),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Expanded(
                child: Container(
                  decoration: BoxDecoration(
                    border: Border.all(color: Colors.white38),
                    borderRadius: BorderRadius.circular(5),
                  ),
                  child: GetBuilder<MessagesPageController>(
                    builder: (controller) {
                      return DashChat(
                        currentUser: _messagesController.user,
                        onSend: (ChatMessage m) {
                          sendMessage(context);
                        },
                        messages: _messagesController.messages,
                        inputOptions: InputOptions(
                          textController: _messagesController.inputTextController,
                          inputTextStyle: const TextStyle(color: Colors.black),
                          sendButtonBuilder: defaultSendButton(color: palette.buttonColor!),
                        ),
                      );
                    },
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
PeteyMFT
  • 75
  • 2
  • 8
  • For those that stumble on this thread. The problem seems to be specific to something I have going on in my project. I worked with the DashChat folks (very helpful) and no one is able to reproduce this issue. If/when I figure out what specifically I am doing that is causing this I will update the thread. If anyone else is experiencing anything similar, please post your notes. Thanks. – PeteyMFT May 24 '23 at 22:18

0 Answers0