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!
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!),
),
);
},
),
),
),
],
),
),
),
);
}