💄 Fix chat input overlaps with message sometimes
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user