fix(pre-planting): 预种开关关闭时隐藏"我的"页面预种按钮
- profile_page: 加载预种配置,根据 isActive 控制预种按钮显隐 - 开关关闭时不显示「预种购买」「预种明细」按钮 - 默认不显示(_isPrePlantingActive = false),加载成功后更新 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e328c75fc1
commit
ef68b7b9c0
|
|
@ -191,6 +191,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
|||
Timer? _walletDebounceTimer;
|
||||
static const int _debounceDelayMs = 300; // 300ms 防抖延迟
|
||||
|
||||
// 预种计划开关状态(后台管理端控制)
|
||||
bool _isPrePlantingActive = false;
|
||||
|
||||
// 隐藏"我的团队"功能的秘密点击计数器
|
||||
int _teamPlantingTapCount = 0;
|
||||
DateTime? _lastTeamPlantingTapTime;
|
||||
|
|
@ -212,6 +215,8 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
|||
});
|
||||
// 启动定时刷新(可见区域的数据)
|
||||
_startAutoRefreshTimer();
|
||||
// 加载预种开关状态(控制预种按钮显隐)
|
||||
_loadPrePlantingConfig();
|
||||
}
|
||||
|
||||
/// 加载应用信息
|
||||
|
|
@ -1234,6 +1239,20 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
|||
context.push(RoutePaths.plantingQuantity);
|
||||
}
|
||||
|
||||
/// 加载预种开关配置(控制预种按钮显隐)
|
||||
Future<void> _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<ProfilePage> {
|
|||
_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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue