fix(profile): 修复伞下树图居中问题;更名提款/转账为提取/转动
- 使用 LayoutBuilder 获取实际容器宽度计算节点显示 - 修改兑换页面按钮文字从"提款/转账"改为"提取/转动" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4d6ce3ce08
commit
7db38114d9
|
|
@ -79,19 +79,22 @@ class _TeamTreeWidgetState extends State<TeamTreeWidget> {
|
|||
static const double nodeHorizontalSpacing = 12.0;
|
||||
static const double nodeVerticalSpacing = 40.0;
|
||||
|
||||
// 当前容器宽度(由 LayoutBuilder 传递)
|
||||
double _containerWidth = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
// 使用实际容器宽度而不是屏幕宽度
|
||||
final containerWidth = constraints.maxWidth;
|
||||
_containerWidth = constraints.maxWidth;
|
||||
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: containerWidth,
|
||||
minWidth: _containerWidth,
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
|
|
@ -110,9 +113,9 @@ class _TeamTreeWidgetState extends State<TeamTreeWidget> {
|
|||
Widget _buildTreeLevel(List<TeamTreeNode> nodes, int level) {
|
||||
if (nodes.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
// 计算屏幕可以显示的最大节点数
|
||||
final screenWidth = MediaQuery.of(context).size.width - 32; // 减去左右padding
|
||||
final maxVisibleNodes = ((screenWidth + nodeHorizontalSpacing) / (nodeWidth + nodeHorizontalSpacing)).floor();
|
||||
// 使用容器实际宽度计算最大节点数(减去 padding)
|
||||
final availableWidth = _containerWidth - 16; // 减去左右 padding (8*2)
|
||||
final maxVisibleNodes = ((availableWidth + nodeHorizontalSpacing) / (nodeWidth + nodeHorizontalSpacing)).floor().clamp(1, 100);
|
||||
|
||||
// 分离需要显示的节点和隐藏的节点
|
||||
List<TeamTreeNode> visibleNodes;
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
// 分隔线
|
||||
_buildDivider(),
|
||||
const SizedBox(height: 24),
|
||||
// 提款/转账按钮
|
||||
// 提取/转动按钮
|
||||
_buildWithdrawButton(),
|
||||
const SizedBox(height: 8),
|
||||
// USDT余额显示
|
||||
|
|
@ -518,7 +518,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
);
|
||||
}
|
||||
|
||||
/// 构建提款/转账按钮
|
||||
/// 构建提取/转动按钮
|
||||
/// 当 USDT 余额为 0 时禁用
|
||||
Widget _buildWithdrawButton() {
|
||||
// 余额为0时禁用
|
||||
|
|
@ -560,7 +560,7 @@ class _TradingPageState extends ConsumerState<TradingPage> {
|
|||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'提款 / 转账',
|
||||
'提取 / 转动',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: 'Inter',
|
||||
|
|
|
|||
Loading…
Reference in New Issue