diff --git a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart index 9aadf541..4580b191 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart @@ -191,6 +191,9 @@ class _ProfilePageState extends ConsumerState { Timer? _walletDebounceTimer; static const int _debounceDelayMs = 300; // 300ms 防抖延迟 + // 预种计划开关状态(后台管理端控制) + bool _isPrePlantingActive = false; + // 隐藏"我的团队"功能的秘密点击计数器 int _teamPlantingTapCount = 0; DateTime? _lastTeamPlantingTapTime; @@ -212,6 +215,8 @@ class _ProfilePageState extends ConsumerState { }); // 启动定时刷新(可见区域的数据) _startAutoRefreshTimer(); + // 加载预种开关状态(控制预种按钮显隐) + _loadPrePlantingConfig(); } /// 加载应用信息 @@ -1234,6 +1239,20 @@ class _ProfilePageState extends ConsumerState { context.push(RoutePaths.plantingQuantity); } + /// 加载预种开关配置(控制预种按钮显隐) + Future _loadPrePlantingConfig() async { + try { + final prePlantingService = ref.read(prePlantingServiceProvider); + final config = await prePlantingService.getConfig(); + if (mounted) { + setState(() => _isPrePlantingActive = config.isActive); + } + } catch (e) { + debugPrint('[ProfilePage] 加载预种配置失败: $e'); + // 失败时保持 false,不显示预种按钮 + } + } + /// [2026-02-17] 进入预种计划购买页 void _goToPrePlantingPurchase() { context.push(RoutePaths.prePlantingPurchase); @@ -1440,8 +1459,11 @@ class _ProfilePageState extends ConsumerState { _buildPlantingButton(), const SizedBox(height: 8), // [2026-02-17] 预种计划按钮(购买 + 查看持仓) - _buildPrePlantingButtons(), - const SizedBox(height: 8), + // 仅在后台管理端预种开关开启时显示 + if (_isPrePlantingActive) ...[ + _buildPrePlantingButtons(), + const SizedBox(height: 8), + ], // [2026-02-19] 纯新增:树转让按钮(发起转让 + 转让记录) _buildTransferButtons(), const SizedBox(height: 16),