fixed minor bug

This commit is contained in:
tom.hempel
2025-09-30 18:37:34 +02:00
parent 72421f36f2
commit c7f2a01f13
2 changed files with 19 additions and 31 deletions

Binary file not shown.

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:ai_chat_lab/services/convai_service.dart'; import 'package:ai_chat_lab/services/convai_service.dart';
import 'package:ai_chat_lab/services/storage_service.dart'; import 'package:ai_chat_lab/services/storage_service.dart';
import 'package:ai_chat_lab/screens/settings_screen.dart'; import 'package:ai_chat_lab/screens/settings_screen.dart';
@ -487,21 +486,10 @@ class _ChatScreenState extends State<ChatScreen> {
) )
else ...[ else ...[
Expanded( Expanded(
child: KeyboardListener(
focusNode: FocusNode(),
onKeyEvent: (KeyEvent event) {
if (event is KeyDownEvent) {
if (event.logicalKey == LogicalKeyboardKey.enter) {
if (!HardwareKeyboard.instance.isShiftPressed) {
_sendMessage();
}
}
}
},
child: TextField( child: TextField(
controller: _messageController, controller: _messageController,
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Type your message... (Enter to send, Shift+Enter for new line)', hintText: 'Type your message...',
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
borderSide: const BorderSide(color: Color(0xFFCBD5E1)), borderSide: const BorderSide(color: Color(0xFFCBD5E1)),
@ -514,11 +502,11 @@ class _ChatScreenState extends State<ChatScreen> {
filled: true, filled: true,
fillColor: Colors.white, fillColor: Colors.white,
), ),
keyboardType: TextInputType.multiline, maxLines: 5,
maxLines: null,
minLines: 1, minLines: 1,
textCapitalization: TextCapitalization.sentences, textCapitalization: TextCapitalization.sentences,
), textInputAction: TextInputAction.send,
onSubmitted: (_) => _sendMessage(),
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),