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), + ), + ), ), ), - ), - ), + ); + }, ); }