From d1cb2be6cf704cc8c1992f9256afed557b8aaf4b Mon Sep 17 00:00:00 2001 From: Jolie <412895109@qq.com> Date: Tue, 13 Jan 2026 14:47:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(chat):=20=E4=BC=98=E5=8C=96=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 GestureDetector 移至 Column 外层以实现点击空白处收起键盘功能 - 调整消息列表区域的容器嵌套结构 - 重新组织组件层级以提升布局逻辑清晰度 --- lib/pages/message/chat_page.dart | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/pages/message/chat_page.dart b/lib/pages/message/chat_page.dart index c3e886b..d653424 100644 --- a/lib/pages/message/chat_page.dart +++ b/lib/pages/message/chat_page.dart @@ -305,18 +305,18 @@ class _ChatPageState extends State { }, ), ), - body: Column( - children: [ - // 消息列表区域 - Expanded( - child: Container( - color: Color(0xffF5F5F5), - child: GestureDetector( - onTap: () { - // 点击消息区域收起键盘 - FocusManager.instance.primaryFocus?.unfocus(); - }, - behavior: HitTestBehavior.opaque, + body: GestureDetector( + onTap: () { + // 点击空白处收起键盘 + FocusManager.instance.primaryFocus?.unfocus(); + }, + behavior: HitTestBehavior.opaque, + child: Column( + children: [ + // 消息列表区域 + Expanded( + child: Container( + color: Color(0xffF5F5F5), child: ListView.builder( controller: _scrollController, reverse: false, @@ -375,7 +375,6 @@ class _ChatPageState extends State { ), ), ), - ), // 使用抽离的聊天输入栏组件 ChatInputBar( onSendMessage: (message) async { @@ -404,6 +403,7 @@ class _ChatPageState extends State { }, ), ], + ), ), ), );