From 3dcf6857158a4f102b143126b4619c5f5b14286d Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 10 Dec 2025 08:07:27 -0800 Subject: [PATCH] feat(mobile): add close button to planting confirm dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../widgets/planting_confirm_dialog.dart | 73 +++++++++++++------ 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/frontend/mobile-app/lib/features/planting/presentation/widgets/planting_confirm_dialog.dart b/frontend/mobile-app/lib/features/planting/presentation/widgets/planting_confirm_dialog.dart index 2cc1686c..c9482265 100644 --- a/frontend/mobile-app/lib/features/planting/presentation/widgets/planting_confirm_dialog.dart +++ b/frontend/mobile-app/lib/features/planting/presentation/widgets/planting_confirm_dialog.dart @@ -84,6 +84,11 @@ class _PlantingConfirmDialogState extends State { } } + /// 关闭弹窗 + void _handleClose() { + Navigator.pop(context, false); + } + @override Widget build(BuildContext context) { return Dialog( @@ -104,27 +109,53 @@ class _PlantingConfirmDialogState extends State { ), ], ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - // 警告图标 - _buildWarningIcon(), - const SizedBox(height: 4), - // 标题 - _buildTitle(), - const SizedBox(height: 4), - // 内容说明 - _buildContent(), - const SizedBox(height: 4), - // 倒计时提示 - _buildCountdownText(), - const SizedBox(height: 4), - // 确认按钮 - _buildConfirmButton(), - ], - ), + child: Stack( + children: [ + // 主内容 + Padding( + padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // 警告图标 + _buildWarningIcon(), + const SizedBox(height: 4), + // 标题 + _buildTitle(), + const SizedBox(height: 4), + // 内容说明 + _buildContent(), + const SizedBox(height: 4), + // 倒计时提示 + _buildCountdownText(), + const SizedBox(height: 4), + // 确认按钮 + _buildConfirmButton(), + ], + ), + ), + // 右上角关闭按钮 + Positioned( + top: 8, + right: 8, + child: GestureDetector( + onTap: _handleClose, + child: Container( + width: 32, + height: 32, + decoration: BoxDecoration( + color: const Color(0x0D000000), + borderRadius: BorderRadius.circular(16), + ), + child: const Icon( + Icons.close, + size: 18, + color: Color(0xFF8B5A2B), + ), + ), + ), + ), + ], ), ), );