💄 Fix chat input overlaps with message sometimes

This commit is contained in:
2025-11-16 11:48:51 +08:00
parent 92bc43e4df
commit 67044148f1
2 changed files with 9 additions and 3 deletions

View File

@@ -619,6 +619,7 @@ class ChatRoomScreen extends HookConsumerWidget {
top: 16, top: 16,
bottom: bottom:
MediaQuery.of(context).padding.bottom + MediaQuery.of(context).padding.bottom +
8 +
inputHeight.value, // Leave space for chat input inputHeight.value, // Leave space for chat input
), ),
controller: scrollController, controller: scrollController,

View File

@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
@@ -412,15 +413,19 @@ class ThoughtChatInterface extends HookConsumerWidget {
attachedPosts: attachedPosts, attachedPosts: attachedPosts,
); );
// Periodic height measurement for dynamic sizing
useEffect(() { useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((_) { final timer = Timer.periodic(const Duration(milliseconds: 50), (_) {
final renderBox = final renderBox =
inputKey.currentContext?.findRenderObject() as RenderBox?; inputKey.currentContext?.findRenderObject() as RenderBox?;
if (renderBox != null) { if (renderBox != null) {
inputHeight.value = renderBox.size.height; final newHeight = renderBox.size.height;
if (newHeight != inputHeight.value) {
inputHeight.value = newHeight;
}
} }
}); });
return null; return timer.cancel;
}, []); }, []);
return Stack( return Stack(