🐛 Fix chat input didn't count safe area

This commit is contained in:
2026-01-02 19:27:17 +08:00
parent cba1a3884b
commit e2efdc4064

View File

@@ -48,6 +48,7 @@ class ChatRoomScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final mediaQuery = MediaQuery.of(context);
final chatRoom = ref.watch(chatRoomProvider(id)); final chatRoom = ref.watch(chatRoomProvider(id));
final chatIdentity = ref.watch(chatRoomIdentityProvider(id)); final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
final isSyncing = ref.watch(chatSyncingProvider); final isSyncing = ref.watch(chatSyncingProvider);
@@ -651,12 +652,12 @@ class ChatRoomScreen extends HookConsumerWidget {
curve: Curves.easeOut, curve: Curves.easeOut,
tween: EdgeInsetsTween( tween: EdgeInsetsTween(
begin: EdgeInsets.only( begin: EdgeInsets.only(
top: MediaQuery.of(context).padding.top, top: mediaQuery.padding.top,
bottom: MediaQuery.of(context).padding.bottom + 8 + height, bottom: mediaQuery.padding.bottom + 8 + height,
), ),
end: EdgeInsets.only( end: EdgeInsets.only(
top: MediaQuery.of(context).padding.top, top: mediaQuery.padding.top,
bottom: MediaQuery.of(context).padding.bottom + 8 + height, bottom: mediaQuery.padding.bottom + 8 + height,
), ),
), ),
builder: (context, padding, child) { builder: (context, padding, child) {
@@ -856,7 +857,7 @@ class ChatRoomScreen extends HookConsumerWidget {
8, 8,
8, 8,
8, 8,
8 + MediaQuery.of(context).padding.bottom, 8 + mediaQuery.padding.bottom,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of( color: Theme.of(
@@ -892,10 +893,7 @@ class ChatRoomScreen extends HookConsumerWidget {
child: Opacity( child: Opacity(
opacity: bottomGradientNotifier.value.value, opacity: bottomGradientNotifier.value.value,
child: Container( child: Container(
height: math.min( height: math.min(mediaQuery.size.height * 0.1, 128),
MediaQuery.of(context).size.height * 0.1,
128,
),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.bottomCenter, begin: Alignment.bottomCenter,
@@ -919,9 +917,9 @@ class ChatRoomScreen extends HookConsumerWidget {
Positioned( Positioned(
left: 0, left: 0,
right: 0, right: 0,
bottom: MediaQuery.of( bottom: mediaQuery
context, .padding
).padding.bottom, // At the very bottom, above gradient .bottom, // At the very bottom, above gradient
child: chatRoom.when( child: chatRoom.when(
data: (room) => ChatInput( data: (room) => ChatInput(
key: inputKey, key: inputKey,
@@ -998,7 +996,7 @@ class ChatRoomScreen extends HookConsumerWidget {
left: 16, left: 16,
right: 16, right: 16,
top: 8, top: 8,
bottom: MediaQuery.of(context).padding.bottom + 8, bottom: mediaQuery.padding.bottom + 8,
), ),
child: Row( child: Row(
children: [ children: [