import 'package:flutter/material.dart'; import '../../controllers/detail_screen_controller.dart'; import '../../theme/app_colors.dart'; import '../common/form_fields/base_text_field.dart'; import '../common/buttons/secondary_button.dart'; /// 웹사이트 URL 섹션 /// 서비스 웹사이트 URL과 해지 관련 정보를 관리하는 섹션입니다. class DetailUrlSection extends StatelessWidget { final DetailScreenController controller; final Animation fadeAnimation; final Animation slideAnimation; const DetailUrlSection({ super.key, required this.controller, required this.fadeAnimation, required this.slideAnimation, }); @override Widget build(BuildContext context) { final baseColor = controller.getCardColor(); return FadeTransition( opacity: fadeAnimation, child: SlideTransition( position: Tween( begin: const Offset(0.0, 0.8), end: Offset.zero, ).animate(CurvedAnimation( parent: controller.animationController!, curve: const Interval(0.4, 1.0, curve: Curves.easeOutCubic), )), child: Container( decoration: BoxDecoration( color: AppColors.glassCard, borderRadius: BorderRadius.circular(20), border: Border.all( color: AppColors.glassBorder.withValues(alpha: 0.1), width: 1, ), boxShadow: [ BoxShadow( color: AppColors.shadowBlack, blurRadius: 10, offset: const Offset(0, 4), ), ], ), child: Padding( padding: const EdgeInsets.all(24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // 헤더 Row( children: [ Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: baseColor.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(12), ), child: Icon( Icons.language_rounded, color: baseColor, size: 24, ), ), const SizedBox(width: 12), const Text( '웹사이트 정보', style: TextStyle( fontSize: 18, fontWeight: FontWeight.w700, color: AppColors.darkNavy, ), ), ], ), const SizedBox(height: 20), // URL 입력 필드 BaseTextField( controller: controller.websiteUrlController, focusNode: controller.websiteUrlFocus, label: '웹사이트 URL', hintText: 'https://example.com', keyboardType: TextInputType.url, prefixIcon: Icon( Icons.link_rounded, color: AppColors.navyGray, ), ), // 해지 안내 섹션 if (controller.subscription.websiteUrl != null && controller.subscription.websiteUrl!.isNotEmpty) ...[ const SizedBox(height: 24), Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: AppColors.warningColor.withValues(alpha: 0.08), borderRadius: BorderRadius.circular(16), border: Border.all( color: AppColors.warningColor.withValues(alpha: 0.4), width: 1, ), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon( Icons.info_outline_rounded, color: AppColors.warningColor, size: 20, ), const SizedBox(width: 8), Text( '해지 안내', style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, color: AppColors.darkNavy, ), ), ], ), const SizedBox(height: 8), Text( '이 서비스를 해지하려면 아래 링크를 통해 해지 페이지로 이동하세요.', style: TextStyle( fontSize: 14, color: AppColors.darkNavy, fontWeight: FontWeight.w500, height: 1.5, ), ), const SizedBox(height: 12), TextLinkButton( text: '해지 페이지로 이동', icon: Icons.open_in_new_rounded, onPressed: controller.openCancellationPage, color: AppColors.warningColor, ), ], ), ), ], // URL 자동 매칭 정보 if (controller.websiteUrlController.text.isEmpty) ...[ const SizedBox(height: 16), Container( padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: AppColors.infoColor.withValues(alpha: 0.08), borderRadius: BorderRadius.circular(12), border: Border.all( color: AppColors.infoColor.withValues(alpha: 0.3), width: 1, ), ), child: Row( children: [ Icon( Icons.auto_fix_high_rounded, color: AppColors.infoColor, size: 20, ), const SizedBox(width: 8), Expanded( child: Text( 'URL이 비어있으면 서비스명을 기반으로 자동 매칭됩니다', style: TextStyle( fontSize: 14, color: AppColors.darkNavy, fontWeight: FontWeight.w500, ), ), ), ], ), ), ], ], ), ), ), ), ); } }