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:
hailin 2026-03-04 07:03:59 -08:00
parent 8b48d80cd4
commit 59097203ae
2 changed files with 77 additions and 63 deletions

View File

@ -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,8 +875,83 @@ 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,
),
],
),
),
); );
} }

View File

@ -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"