removed useless container and sendOnEnter

This commit is contained in:
NicKoehler 2023-06-08 12:51:13 +02:00
parent 4e00945a5d
commit 92fada0c8e
No known key found for this signature in database
GPG Key ID: 0EC502B679A11DD1

View File

@ -50,13 +50,7 @@ class ChatPage extends StatelessWidget implements PageShape {
child: Consumer<ChatModel>( child: Consumer<ChatModel>(
builder: (context, chatModel, child) { builder: (context, chatModel, child) {
final currentUser = chatModel.currentUser; final currentUser = chatModel.currentUser;
return Container( return Stack(
padding: EdgeInsets.symmetric(vertical: 5.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Theme.of(context).colorScheme.background,
),
child: Stack(
children: [ children: [
LayoutBuilder(builder: (context, constraints) { LayoutBuilder(builder: (context, constraints) {
final chat = DashChat( final chat = DashChat(
@ -65,16 +59,14 @@ class ChatPage extends StatelessWidget implements PageShape {
chatModel.inputNode.requestFocus(); chatModel.inputNode.requestFocus();
}, },
currentUser: chatModel.me, currentUser: chatModel.me,
messages: chatModel messages:
.messages[chatModel.currentID]?.chatMessages ?? chatModel.messages[chatModel.currentID]?.chatMessages ??
[], [],
inputOptions: InputOptions( inputOptions: InputOptions(
sendOnEnter: true,
focusNode: chatModel.inputNode, focusNode: chatModel.inputNode,
inputTextStyle: TextStyle( inputTextStyle: TextStyle(
fontSize: 14, fontSize: 14,
color: color: Theme.of(context).textTheme.titleLarge?.color),
Theme.of(context).textTheme.titleLarge?.color),
inputDecoration: InputDecoration( inputDecoration: InputDecoration(
isDense: true, isDense: true,
hintText: translate('Write a message'), hintText: translate('Write a message'),
@ -123,7 +115,6 @@ class ChatPage extends StatelessWidget implements PageShape {
messageDecorationBuilder: messageDecorationBuilder:
(message, previousMessage, nextMessage) { (message, previousMessage, nextMessage) {
final isOwnMessage = message.user.id.isBlank!; final isOwnMessage = message.user.id.isBlank!;
print("message.user.id = ${message.user.id}\n");
return defaultMessageDecoration( return defaultMessageDecoration(
color: color:
isOwnMessage ? MyTheme.accent : Colors.blueGrey, isOwnMessage ? MyTheme.accent : Colors.blueGrey,
@ -144,8 +135,7 @@ class ChatPage extends StatelessWidget implements PageShape {
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
child: Row( child: Row(
children: [ children: [
Icon(Icons.account_circle, Icon(Icons.account_circle, color: MyTheme.accent80),
color: MyTheme.accent80),
SizedBox(width: 5), SizedBox(width: 5),
Text( Text(
"${currentUser.firstName} ${currentUser.id}", "${currentUser.firstName} ${currentUser.id}",
@ -155,8 +145,7 @@ class ChatPage extends StatelessWidget implements PageShape {
), ),
), ),
], ],
), ).paddingOnly(bottom: 8);
);
}, },
), ),
), ),