Matthias Nott
2026-07-08 77911f6418ceb771c5f0b6b2aa33328c7aa5530a
lib/widgets/input_bar.dart
....@@ -1,4 +1,5 @@
11 import 'package:flutter/material.dart';
2
+import 'package:flutter/services.dart';
23
34 import '../providers/providers.dart';
45 import '../theme/app_theme.dart';
....@@ -97,23 +98,37 @@
9798 const SizedBox(width: 8),
9899 // Text field
99100 Expanded(
100
- child: TextField(
101
- controller: textController,
102
- decoration: InputDecoration(
103
- hintText: 'Type a message...',
104
- filled: true,
105
- fillColor: isDark ? AppColors.darkInputBg : AppColors.lightInputBg,
106
- border: OutlineInputBorder(
107
- borderRadius: BorderRadius.circular(24),
108
- borderSide: BorderSide.none,
101
+ child: CallbackShortcuts(
102
+ // Cmd+Enter (or Ctrl+Enter on other keyboards) sends the message.
103
+ // Plain Enter still inserts a newline (textInputAction: newline).
104
+ bindings: <ShortcutActivator, VoidCallback>{
105
+ const SingleActivator(LogicalKeyboardKey.enter, meta: true):
106
+ onSendText,
107
+ const SingleActivator(LogicalKeyboardKey.enter, control: true):
108
+ onSendText,
109
+ },
110
+ child: TextField(
111
+ controller: textController,
112
+ decoration: InputDecoration(
113
+ hintText: 'Type a message...',
114
+ filled: true,
115
+ fillColor: isDark
116
+ ? AppColors.darkInputBg
117
+ : AppColors.lightInputBg,
118
+ border: OutlineInputBorder(
119
+ borderRadius: BorderRadius.circular(24),
120
+ borderSide: BorderSide.none,
121
+ ),
122
+ contentPadding: const EdgeInsets.symmetric(
123
+ horizontal: 16,
124
+ vertical: 10,
125
+ ),
126
+ isDense: true,
109127 ),
110
- contentPadding:
111
- const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
112
- isDense: true,
128
+ textInputAction: TextInputAction.newline,
129
+ maxLines: 4,
130
+ minLines: 1,
113131 ),
114
- textInputAction: TextInputAction.newline,
115
- maxLines: 4,
116
- minLines: 1,
117132 ),
118133 ),
119134 const SizedBox(width: 8),