diff --git a/lib/pages/discover/live_room_page.dart b/lib/pages/discover/live_room_page.dart index ff7bc85..1611e89 100644 --- a/lib/pages/discover/live_room_page.dart +++ b/lib/pages/discover/live_room_page.dart @@ -344,7 +344,21 @@ class _LiveRoomPageState extends State { // SVGA 动画播放组件 const SvgaPlayerWidget(), // 输入对话框 - if (_showInputDialog) + if (_showInputDialog) ...[ + // 遮罩层,点击时隐藏对话框和键盘(放在对话框下方,对话框会在上面拦截点击) + Positioned.fill( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + // 隐藏键盘 + FocusScope.of(context).unfocus(); + // 隐藏对话框 + _hideInputDialog(); + }, + child: Container(color: Colors.transparent), + ), + ), + // 输入对话框(放在遮罩层上面,会自动拦截点击事件) AnimatedPositioned( duration: const Duration(milliseconds: 200), curve: Curves.easeOut, @@ -358,6 +372,7 @@ class _LiveRoomPageState extends State { onClose: _hideInputDialog, ), ), + ], ], ), ),