chore(nav): 暂时隐藏矿机Tab
- 底部导航从4个减少到3个: 龙虎榜、交易、我 - 保留矿机相关代码注释,方便后续恢复 - 调整索引映射以匹配新的Tab顺序 🤖 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
db37fbf860
commit
5219a5a39f
|
|
@ -60,25 +60,27 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
|
||||||
|
|
||||||
int _getCurrentIndex(BuildContext context) {
|
int _getCurrentIndex(BuildContext context) {
|
||||||
final location = GoRouterState.of(context).uri.path;
|
final location = GoRouterState.of(context).uri.path;
|
||||||
|
// 矿机Tab暂时隐藏,索引调整为: 0-龙虎榜, 1-交易, 2-我
|
||||||
if (location.startsWith(RoutePaths.ranking)) return 0;
|
if (location.startsWith(RoutePaths.ranking)) return 0;
|
||||||
if (location.startsWith(RoutePaths.mining)) return 1;
|
// if (location.startsWith(RoutePaths.mining)) return 1; // 矿机暂时隐藏
|
||||||
if (location.startsWith(RoutePaths.trading)) return 2;
|
if (location.startsWith(RoutePaths.trading)) return 1;
|
||||||
if (location.startsWith(RoutePaths.profile)) return 3;
|
if (location.startsWith(RoutePaths.profile)) return 2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTabTapped(BuildContext context, int index) {
|
void _onTabTapped(BuildContext context, int index) {
|
||||||
|
// 矿机Tab暂时隐藏,索引调整为: 0-龙虎榜, 1-交易, 2-我
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
context.go(RoutePaths.ranking);
|
context.go(RoutePaths.ranking);
|
||||||
break;
|
break;
|
||||||
|
// case 1: // 矿机暂时隐藏
|
||||||
|
// context.go(RoutePaths.mining);
|
||||||
|
// break;
|
||||||
case 1:
|
case 1:
|
||||||
context.go(RoutePaths.mining);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
context.go(RoutePaths.trading);
|
context.go(RoutePaths.trading);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 2:
|
||||||
context.go(RoutePaths.profile);
|
context.go(RoutePaths.profile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// 底部导航栏组件
|
/// 底部导航栏组件
|
||||||
/// 包含四个Tab:龙虎榜、矿机、交易、我
|
/// 包含三个Tab:龙虎榜、交易、我
|
||||||
|
/// 注意:矿机Tab暂时隐藏(未删除代码,方便后续恢复)
|
||||||
/// 自定义设计风格,使用 LayoutBuilder 确保自适应
|
/// 自定义设计风格,使用 LayoutBuilder 确保自适应
|
||||||
class BottomNavBar extends StatelessWidget {
|
class BottomNavBar extends StatelessWidget {
|
||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
|
|
@ -41,20 +42,21 @@ class BottomNavBar extends StatelessWidget {
|
||||||
activeIcon: Icons.leaderboard,
|
activeIcon: Icons.leaderboard,
|
||||||
label: '龙虎榜',
|
label: '龙虎榜',
|
||||||
),
|
),
|
||||||
|
// 矿机Tab暂时隐藏,保留代码方便后续恢复
|
||||||
|
// _buildNavItem(
|
||||||
|
// index: 1,
|
||||||
|
// icon: Icons.memory_outlined,
|
||||||
|
// activeIcon: Icons.memory,
|
||||||
|
// label: '矿机',
|
||||||
|
// ),
|
||||||
_buildNavItem(
|
_buildNavItem(
|
||||||
index: 1,
|
index: 1, // 原 index: 2
|
||||||
icon: Icons.memory_outlined,
|
|
||||||
activeIcon: Icons.memory,
|
|
||||||
label: '矿机',
|
|
||||||
),
|
|
||||||
_buildNavItem(
|
|
||||||
index: 2,
|
|
||||||
icon: Icons.swap_horiz_outlined,
|
icon: Icons.swap_horiz_outlined,
|
||||||
activeIcon: Icons.swap_horiz,
|
activeIcon: Icons.swap_horiz,
|
||||||
label: '交易',
|
label: '交易',
|
||||||
),
|
),
|
||||||
_buildNavItem(
|
_buildNavItem(
|
||||||
index: 3,
|
index: 2, // 原 index: 3
|
||||||
icon: Icons.person_outline,
|
icon: Icons.person_outline,
|
||||||
activeIcon: Icons.person,
|
activeIcon: Icons.person,
|
||||||
label: '我',
|
label: '我',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue