From 4d6ce3ce08e51dd5508889a91e94d6f547ae0049 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 15 Dec 2025 04:25:19 -0800 Subject: [PATCH] =?UTF-8?q?fix(profile):=20=E4=BF=AE=E5=A4=8D=E4=BC=9E?= =?UTF-8?q?=E4=B8=8B=E6=A0=91=E5=9B=BE=E6=9C=AA=E5=B1=85=E4=B8=AD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 LayoutBuilder 获取实际容器宽度而不是屏幕宽度 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../widgets/team_tree_widget.dart | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/frontend/mobile-app/lib/features/profile/presentation/widgets/team_tree_widget.dart b/frontend/mobile-app/lib/features/profile/presentation/widgets/team_tree_widget.dart index ccd72b3a..805d4f86 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/widgets/team_tree_widget.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/widgets/team_tree_widget.dart @@ -81,23 +81,28 @@ class _TeamTreeWidgetState extends State { @override Widget build(BuildContext context) { - final screenWidth = MediaQuery.of(context).size.width; + return LayoutBuilder( + builder: (context, constraints) { + // 使用实际容器宽度而不是屏幕宽度 + final containerWidth = constraints.maxWidth; - return SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minWidth: screenWidth, - ), - child: Center( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: _buildTreeLevel([widget.rootNode], 0), + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minWidth: containerWidth, + ), + child: Center( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: _buildTreeLevel([widget.rootNode], 0), + ), + ), ), ), - ), - ), + ); + }, ); }