fix(app): 预种计划入口移至自助申请授权页市团队下方
## 问题
上一版错误将「申请预种计划」入口放在「我」页面主区域,
实际需求是放在「自助申请授权」页的「申请市团队」卡片下方。
## 改动内容
### authorization_apply_page.dart
- import route_paths.dart
- `_buildAuthorizationTypes()` 将 `.map()` 展开为 for 循环,
在 AuthorizationType.cityTeam item 渲染完后插入 `_buildPrePlantingEntry()`
- 新增 `_buildPrePlantingEntry()` 方法:
· 样式:金色(0xFFD4AF37)卡片,左侧图标圆角背景 + 右侧箭头,
副标题「购买预种份额 · 查看明细 · 团队预种统计」
· 点击跳转 RoutePaths.prePlantingHub(预种计划 Hub 页)
### profile_page.dart(撤销上一版在主页的改动)
- 移除 `bool _isPrePlantingActive` 状态变量
- 移除 `_loadPrePlantingConfig()` 方法及 initState 调用
- 移除布局中的预种入口按钮区块
- 移除 `_buildPrePlantingEntryButton()` 方法
Hub 页面(pre_planting_hub_page.dart)和路由定义保持不变,
入口位置从「我」主页改为自助申请授权页的市团队下方。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8b48d80cd4
commit
59097203ae
|
|
@ -7,6 +7,7 @@ import 'package:city_pickers/city_pickers.dart';
|
||||||
import '../../../../core/di/injection_container.dart';
|
import '../../../../core/di/injection_container.dart';
|
||||||
import '../../../../core/storage/storage_keys.dart';
|
import '../../../../core/storage/storage_keys.dart';
|
||||||
import '../../../../core/services/authorization_service.dart';
|
import '../../../../core/services/authorization_service.dart';
|
||||||
|
import '../../../../routes/route_paths.dart';
|
||||||
|
|
||||||
/// 授权类型枚举
|
/// 授权类型枚举
|
||||||
enum AuthorizationType {
|
enum AuthorizationType {
|
||||||
|
|
@ -874,11 +875,86 @@ class _AuthorizationApplyPageState
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
// 原代码: ...AuthorizationType.values.map((type) => _buildTypeItem(type)),
|
// 原代码: ...AuthorizationType.values.map((type) => _buildTypeItem(type)),
|
||||||
...availableTypes.map((type) => _buildTypeItem(type)),
|
for (final type in availableTypes) ...[
|
||||||
|
_buildTypeItem(type),
|
||||||
|
// [2026-03-04] 市团队下方插入「申请预种计划」入口
|
||||||
|
if (type == AuthorizationType.cityTeam)
|
||||||
|
_buildPrePlantingEntry(),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [2026-03-04] 申请预种计划入口(位于市团队申请卡片下方)
|
||||||
|
///
|
||||||
|
/// 点击后跳转至预种计划 Hub 页(预种购买 / 预种明细 / 团队预种)
|
||||||
|
Widget _buildPrePlantingEntry() {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => context.push(RoutePaths.prePlantingHub),
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
margin: const EdgeInsets.only(bottom: 12),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFD4AF37).withValues(alpha: 0.08),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(
|
||||||
|
color: const Color(0xFFD4AF37).withValues(alpha: 0.35),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFD4AF37).withValues(alpha: 0.15),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.eco_outlined,
|
||||||
|
color: Color(0xFFD4AF37),
|
||||||
|
size: 22,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
const Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'申请预种计划',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontFamily: 'Inter',
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xFFD4AF37),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 2),
|
||||||
|
Text(
|
||||||
|
'购买预种份额 · 查看明细 · 团队预种统计',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontFamily: 'Inter',
|
||||||
|
color: Color(0xFF8D6E63),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
Icons.chevron_right,
|
||||||
|
color: Color(0xFFD4AF37),
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// 构建授权类型项
|
/// 构建授权类型项
|
||||||
Widget _buildTypeItem(AuthorizationType type) {
|
Widget _buildTypeItem(AuthorizationType type) {
|
||||||
final isSelected = _selectedType == type;
|
final isSelected = _selectedType == type;
|
||||||
|
|
|
||||||
|
|
@ -192,9 +192,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||||
Timer? _walletDebounceTimer;
|
Timer? _walletDebounceTimer;
|
||||||
static const int _debounceDelayMs = 300; // 300ms 防抖延迟
|
static const int _debounceDelayMs = 300; // 300ms 防抖延迟
|
||||||
|
|
||||||
// 预种计划开关状态(后台管理端控制)
|
|
||||||
bool _isPrePlantingActive = false;
|
|
||||||
|
|
||||||
// 隐藏"我的团队"功能的秘密点击计数器
|
// 隐藏"我的团队"功能的秘密点击计数器
|
||||||
int _teamPlantingTapCount = 0;
|
int _teamPlantingTapCount = 0;
|
||||||
DateTime? _lastTeamPlantingTapTime;
|
DateTime? _lastTeamPlantingTapTime;
|
||||||
|
|
@ -216,8 +213,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||||
});
|
});
|
||||||
// 启动定时刷新(可见区域的数据)
|
// 启动定时刷新(可见区域的数据)
|
||||||
_startAutoRefreshTimer();
|
_startAutoRefreshTimer();
|
||||||
// 加载预种开关状态(控制预种按钮显隐)
|
|
||||||
_loadPrePlantingConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 加载应用信息
|
/// 加载应用信息
|
||||||
|
|
@ -1342,20 +1337,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||||
context.push(RoutePaths.plantingQuantity);
|
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,不显示预种按钮
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 谷歌验证器
|
/// 谷歌验证器
|
||||||
void _goToGoogleAuth() {
|
void _goToGoogleAuth() {
|
||||||
context.push(RoutePaths.googleAuth);
|
context.push(RoutePaths.googleAuth);
|
||||||
|
|
@ -1541,12 +1522,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||||
// 认种按钮
|
// 认种按钮
|
||||||
_buildPlantingButton(),
|
_buildPlantingButton(),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// [2026-03-04] 预种计划入口(三功能合并为单按钮)
|
|
||||||
// 仅在后台管理端预种开关开启时显示
|
|
||||||
if (_isPrePlantingActive) ...[
|
|
||||||
_buildPrePlantingEntryButton(),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
],
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// 主要内容卡片(懒加载:收益数据)
|
// 主要内容卡片(懒加载:收益数据)
|
||||||
VisibilityDetector(
|
VisibilityDetector(
|
||||||
|
|
@ -2031,43 +2006,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [2026-03-04] 构建预种计划入口按钮(原三按钮合并为一个)
|
|
||||||
Widget _buildPrePlantingEntryButton() {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () => context.push(RoutePaths.prePlantingHub),
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 48,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFD4AF37).withValues(alpha: 0.15),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(
|
|
||||||
color: const Color(0xFFD4AF37).withValues(alpha: 0.4),
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: const Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(Icons.eco_outlined, color: Color(0xFFD4AF37), size: 20),
|
|
||||||
SizedBox(width: 8),
|
|
||||||
Text(
|
|
||||||
'申请预种计划',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontFamily: 'Inter',
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Color(0xFFD4AF37),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 4),
|
|
||||||
Icon(Icons.chevron_right, color: Color(0xFFD4AF37), size: 18),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建主要内容卡片
|
/// 构建主要内容卡片
|
||||||
Widget _buildMainContentCard() {
|
Widget _buildMainContentCard() {
|
||||||
// Widget 结构始终保持,数据值根据状态显示 "0" 或实际值
|
// Widget 结构始终保持,数据值根据状态显示 "0" 或实际值
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue