fixed minor bug
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
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/storage_service.dart';
|
||||
import 'package:ai_chat_lab/screens/settings_screen.dart';
|
||||
@ -487,38 +486,27 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
)
|
||||
else ...[
|
||||
Expanded(
|
||||
child: KeyboardListener(
|
||||
focusNode: FocusNode(),
|
||||
onKeyEvent: (KeyEvent event) {
|
||||
if (event is KeyDownEvent) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
if (!HardwareKeyboard.instance.isShiftPressed) {
|
||||
_sendMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
child: TextField(
|
||||
controller: _messageController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Type your message... (Enter to send, Shift+Enter for new line)',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderSide: const BorderSide(color: Color(0xFFCBD5E1)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderSide: const BorderSide(color: Color(0xFF4F8CFF), width: 2),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
child: TextField(
|
||||
controller: _messageController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Type your message...',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderSide: const BorderSide(color: Color(0xFFCBD5E1)),
|
||||
),
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
minLines: 1,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderSide: const BorderSide(color: Color(0xFF4F8CFF), width: 2),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
),
|
||||
maxLines: 5,
|
||||
minLines: 1,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
textInputAction: TextInputAction.send,
|
||||
onSubmitted: (_) => _sendMessage(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
Reference in New Issue
Block a user