From f0f44aeb397df638e89aa2be3294e8515a2b27e9 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 3 Jan 2026 23:52:44 -0800 Subject: [PATCH] feat(mobile-app): show all nodes in team tree with horizontal scroll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the ellipsis logic that hides nodes when there are too many. Now all nodes are displayed and users can scroll horizontally to see them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../widgets/team_tree_widget.dart | 36 +++---------------- 1 file changed, 4 insertions(+), 32 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 06f9e88a..66767303 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 @@ -113,30 +113,7 @@ class _TeamTreeWidgetState extends State { Widget _buildTreeLevel(List nodes, int level) { if (nodes.isEmpty) return const SizedBox.shrink(); - // 使用容器实际宽度计算最大节点数(减去 padding) - final availableWidth = _containerWidth - 16; // 减去左右 padding (8*2) - final maxVisibleNodes = ((availableWidth + nodeHorizontalSpacing) / (nodeWidth + nodeHorizontalSpacing)).floor().clamp(1, 100); - - // 分离需要显示的节点和隐藏的节点 - List visibleNodes; - List hiddenNodes; - - if (nodes.length <= maxVisibleNodes) { - visibleNodes = nodes; - hiddenNodes = []; - } else { - // 显示前几个和最后一个,中间显示省略号 - final showCount = maxVisibleNodes - 1; // 留一个位置给省略号 - final frontCount = (showCount / 2).ceil(); - final backCount = showCount - frontCount; - - visibleNodes = [ - ...nodes.sublist(0, frontCount), - ...nodes.sublist(nodes.length - backCount), - ]; - hiddenNodes = nodes.sublist(frontCount, nodes.length - backCount); - } - + // 显示所有节点,允许左右滚动 return Column( children: [ // 当前层的节点 @@ -144,14 +121,9 @@ class _TeamTreeWidgetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - for (int i = 0; i < visibleNodes.length; i++) ...[ - if (i == (maxVisibleNodes - 1) ~/ 2 && hiddenNodes.isNotEmpty) ...[ - // 在中间位置插入省略号节点 - _buildEllipsisNode(hiddenNodes), - SizedBox(width: nodeHorizontalSpacing), - ], - _buildNodeWithChildren(visibleNodes[i]), - if (i < visibleNodes.length - 1) SizedBox(width: nodeHorizontalSpacing), + for (int i = 0; i < nodes.length; i++) ...[ + _buildNodeWithChildren(nodes[i]), + if (i < nodes.length - 1) SizedBox(width: nodeHorizontalSpacing), ], ], ),