💄 Optimize thought input space to avoid input cover message

This commit is contained in:
2025-11-16 11:22:47 +08:00
parent 9a75228e38
commit 40c0e052cf
3 changed files with 19 additions and 3 deletions

View File

@@ -401,6 +401,9 @@ class ThoughtChatInterface extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final inputKey = useMemoized(() => GlobalKey());
final inputHeight = useState<double>(80.0);
final chatState = useThoughtChat(
ref,
initialThoughts: initialThoughts,
@@ -409,6 +412,17 @@ class ThoughtChatInterface extends HookConsumerWidget {
attachedPosts: attachedPosts,
);
useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
final renderBox =
inputKey.currentContext?.findRenderObject() as RenderBox?;
if (renderBox != null) {
inputHeight.value = renderBox.size.height;
}
});
return null;
}, []);
return Stack(
children: [
// Thoughts list
@@ -425,7 +439,8 @@ class ThoughtChatInterface extends HookConsumerWidget {
top: 16,
bottom:
MediaQuery.of(context).padding.bottom +
80, // Leave space for thought input
56 +
inputHeight.value, // Leave space for thought input
),
reverse: true,
itemCount:
@@ -492,6 +507,7 @@ class ThoughtChatInterface extends HookConsumerWidget {
child: Container(
constraints: BoxConstraints(maxWidth: 640),
child: ThoughtInput(
key: inputKey,
messageController: chatState.messageController,
isStreaming: chatState.isStreaming.value,
onSend: chatState.sendMessage,