@tduncan / Cortana / commits / 5914391

fixes #2 (Input field overlaps)

abdulmominsakib committed Apr 22, 2026 at 08:08 UTC 59143914c3dbf121c687b46ee312b28d044b261e
2 files changed +135 -133
lib/features/chat/views/components/chat_input_bar.dart
+134 -132
@@ -154,154 +154,156 @@ class _ChatInputBarState extends ConsumerState<ChatInputBar>
154 (_controller.text.trim().isNotEmpty || _attachedFiles.isNotEmpty) &&
155 !widget.isStreaming;
156
157 - return Container(
158 - margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
159 - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
160 - decoration: BoxDecoration(
161 - color: isDark ? const Color(0xFF1C1C1C) : Colors.white,
162 - borderRadius: BorderRadius.circular(40),
163 - boxShadow: [
164 - BoxShadow(
165 - color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.08),
166 - blurRadius: 20,
167 - offset: const Offset(0, 4),
157 + return SafeArea(
158 + child: Container(
159 + margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
160 + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
161 + decoration: BoxDecoration(
162 + color: isDark ? const Color(0xFF1C1C1C) : Colors.white,
163 + borderRadius: BorderRadius.circular(40),
164 + boxShadow: [
165 + BoxShadow(
166 + color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.08),
167 + blurRadius: 20,
168 + offset: const Offset(0, 4),
169 + ),
170 + ],
171 + border: Border.all(
172 + color: isDark ? const Color(0xFF2E2E2E) : const Color(0xFFE5E5E5),
173 + width: 1.2,
174 ),
169 - ],
170 - border: Border.all(
171 - color: isDark ? const Color(0xFF2E2E2E) : const Color(0xFFE5E5E5),
172 - width: 1.2,
175 ),
174 - ),
175 - child: Column(
176 - mainAxisSize: MainAxisSize.min,
177 - children: [
178 - // Attachment Preview Area
179 - AnimatedSize(
180 - duration: const Duration(milliseconds: 200),
181 - curve: Curves.easeOut,
182 - child: _attachedFiles.isEmpty
183 - ? const SizedBox.shrink()
184 - : Container(
185 - height: 70,
186 - padding: const EdgeInsets.only(
187 - left: 12,
188 - right: 12,
189 - top: 8,
190 - bottom: 4,
191 - ),
192 - child: ListView.separated(
193 - scrollDirection: Axis.horizontal,
194 - itemCount: _attachedFiles.length,
195 - separatorBuilder: (_, _) => const SizedBox(width: 8),
196 - itemBuilder: (context, index) {
197 - final file = _attachedFiles[index];
198 - return Stack(
199 - clipBehavior: Clip.none,
200 - children: [
201 - Container(
202 - decoration: BoxDecoration(
203 - borderRadius: BorderRadius.circular(12),
204 - border: Border.all(
205 - color: isDark
206 - ? const Color(0xFF333333)
207 - : const Color(0xFFE0E0E0),
176 + child: Column(
177 + mainAxisSize: MainAxisSize.min,
178 + children: [
179 + // Attachment Preview Area
180 + AnimatedSize(
181 + duration: const Duration(milliseconds: 200),
182 + curve: Curves.easeOut,
183 + child: _attachedFiles.isEmpty
184 + ? const SizedBox.shrink()
185 + : Container(
186 + height: 70,
187 + padding: const EdgeInsets.only(
188 + left: 12,
189 + right: 12,
190 + top: 8,
191 + bottom: 4,
192 + ),
193 + child: ListView.separated(
194 + scrollDirection: Axis.horizontal,
195 + itemCount: _attachedFiles.length,
196 + separatorBuilder: (_, _) => const SizedBox(width: 8),
197 + itemBuilder: (context, index) {
198 + final file = _attachedFiles[index];
199 + return Stack(
200 + clipBehavior: Clip.none,
201 + children: [
202 + Container(
203 + decoration: BoxDecoration(
204 + borderRadius: BorderRadius.circular(12),
205 + border: Border.all(
206 + color: isDark
207 + ? const Color(0xFF333333)
208 + : const Color(0xFFE0E0E0),
209 + ),
210 ),
209 - ),
210 - child: ClipRRect(
211 - borderRadius: BorderRadius.circular(11),
212 - child: Image.file(
213 - file,
214 - width: 48,
215 - height: 48,
216 - fit: BoxFit.cover,
211 + child: ClipRRect(
212 + borderRadius: BorderRadius.circular(11),
213 + child: Image.file(
214 + file,
215 + width: 48,
216 + height: 48,
217 + fit: BoxFit.cover,
218 + ),
219 ),
220 ),
219 - ),
220 - Positioned(
221 - top: -4,
222 - right: -4,
223 - child: GestureDetector(
224 - onTap: () => setState(
225 - () => _attachedFiles.removeAt(index),
226 - ),
227 - child: Container(
228 - width: 18,
229 - height: 18,
230 - decoration: const BoxDecoration(
231 - color: Colors.black,
232 - shape: BoxShape.circle,
221 + Positioned(
222 + top: -4,
223 + right: -4,
224 + child: GestureDetector(
225 + onTap: () => setState(
226 + () => _attachedFiles.removeAt(index),
227 ),
234 - child: const Icon(
235 - Icons.close,
236 - size: 10,
237 - color: Colors.white,
228 + child: Container(
229 + width: 18,
230 + height: 18,
231 + decoration: const BoxDecoration(
232 + color: Colors.black,
233 + shape: BoxShape.circle,
234 + ),
235 + child: const Icon(
236 + Icons.close,
237 + size: 10,
238 + color: Colors.white,
239 + ),
240 ),
241 ),
242 ),
241 - ),
242 - ],
243 - );
244 - },
243 + ],
244 + );
245 + },
246 + ),
247 ),
248 + ),
249 + // Input Main Bar
250 + Row(
251 + children: [
252 + // Add Attachment Button
253 + IconButton(
254 + icon: HugeIcon(
255 + icon: HugeIcons.strokeRoundedPlusSign,
256 + color: isDark ? Colors.white70 : Colors.black87,
257 + size: 22,
258 ),
247 - ),
248 - // Input Main Bar
249 - Row(
250 - children: [
251 - // Add Attachment Button
252 - IconButton(
253 - icon: HugeIcon(
254 - icon: HugeIcons.strokeRoundedPlusSign,
255 - color: isDark ? Colors.white70 : Colors.black87,
256 - size: 22,
259 + onPressed: isConnected ? _handleAttach : null,
260 + tooltip: 'Attach images',
261 ),
258 - onPressed: isConnected ? _handleAttach : null,
259 - tooltip: 'Attach images',
260 - ),
261 - const SizedBox(width: 4),
262 - // Text Field
263 - Expanded(
264 - child: TextField(
265 - controller: _controller,
266 - focusNode: _focusNode,
267 - enabled: widget.enabled,
268 - maxLines: 5,
269 - minLines: 1,
270 - textInputAction: TextInputAction.newline,
271 - keyboardType: TextInputType.multiline,
272 - onChanged: (text) {
273 - setState(() {});
274 - },
275 - style: TextStyle(
276 - fontSize: 15,
277 - color: isDark ? Colors.white : Colors.black87,
278 - ),
279 - decoration: InputDecoration(
280 - hintText: 'Ask anything',
281 - hintStyle: TextStyle(
282 - color: isDark ? Colors.white38 : Colors.black38,
262 + const SizedBox(width: 4),
263 + // Text Field
264 + Expanded(
265 + child: TextField(
266 + controller: _controller,
267 + focusNode: _focusNode,
268 + enabled: widget.enabled,
269 + maxLines: 5,
270 + minLines: 1,
271 + textInputAction: TextInputAction.newline,
272 + keyboardType: TextInputType.multiline,
273 + onChanged: (text) {
274 + setState(() {});
275 + },
276 + style: TextStyle(
277 fontSize: 15,
284 - fontWeight: FontWeight.w400,
278 + color: isDark ? Colors.white : Colors.black87,
279 + ),
280 + decoration: InputDecoration(
281 + hintText: 'Ask anything',
282 + hintStyle: TextStyle(
283 + color: isDark ? Colors.white38 : Colors.black38,
284 + fontSize: 15,
285 + fontWeight: FontWeight.w400,
286 + ),
287 + border: InputBorder.none,
288 + isDense: true,
289 + contentPadding: const EdgeInsets.symmetric(vertical: 12),
290 ),
286 - border: InputBorder.none,
287 - isDense: true,
288 - contentPadding: const EdgeInsets.symmetric(vertical: 12),
291 ),
292 ),
291 - ),
292 - const SizedBox(width: 8),
293 - // Mic Icon (Visual only as per image)
294 - // HugeIcon(
295 - // icon: HugeIcons.strokeRoundedMic01,
296 - // color: isDark ? Colors.white38 : Colors.black38,
297 - // size: 22,
298 - // ),
299 - // const SizedBox(width: 8),
300 - // Action Button (Send/Stop)
301 - _buildActionButton(canSend, isDark),
302 - ],
303 - ),
304 - ],
293 + const SizedBox(width: 8),
294 + // Mic Icon (Visual only as per image)
295 + // HugeIcon(
296 + // icon: HugeIcons.strokeRoundedMic01,
297 + // color: isDark ? Colors.white38 : Colors.black38,
298 + // size: 22,
299 + // ),
300 + // const SizedBox(width: 8),
301 + // Action Button (Send/Stop)
302 + _buildActionButton(canSend, isDark),
303 + ],
304 + ),
305 + ],
306 + ),
307 ),
308 );
309 }
pubspec.yaml
+1 -1
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
16 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
17 # In Windows, build-name is used as the major, minor, and patch parts
18 # of the product and file versions while build-number is used as the build suffix.
19 -version: 1.2.0+17
19 +version: 1.2.0+18
20
21 environment:
22 sdk: ^3.11.0