import 'package:flutter/material.dart'; import 'dart:ui'; import '../../theme/app_colors.dart'; import '../common/buttons/primary_button.dart'; import '../common/buttons/secondary_button.dart'; /// 삭제 확인 다이얼로그 /// 글래스모피즘 스타일의 삭제 확인 다이얼로그입니다. class DeleteConfirmationDialog extends StatelessWidget { final String serviceName; const DeleteConfirmationDialog({ super.key, required this.serviceName, }); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.transparent, elevation: 0, child: Container( constraints: const BoxConstraints(maxWidth: 400), child: Stack( children: [ // 글래스모피즘 배경 ClipRRect( borderRadius: BorderRadius.circular(24), child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), child: Container( decoration: BoxDecoration( color: AppColors.glassCard.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(24), border: Border.all( color: AppColors.glassBorder, width: 1, ), ), padding: const EdgeInsets.all(32), child: Column( mainAxisSize: MainAxisSize.min, children: [ // 아이콘 Container( width: 80, height: 80, decoration: BoxDecoration( color: Colors.red.withValues(alpha: 0.1), shape: BoxShape.circle, ), child: const Icon( Icons.delete_forever_rounded, color: Colors.red, size: 40, ), ), const SizedBox(height: 24), // 타이틀 const Text( '구독 삭제', style: TextStyle( fontSize: 24, fontWeight: FontWeight.w700, color: AppColors.textPrimary, ), ), const SizedBox(height: 12), // 설명 RichText( textAlign: TextAlign.center, text: TextSpan( style: const TextStyle( fontSize: 16, color: AppColors.textSecondary, height: 1.5, ), children: [ const TextSpan(text: '정말로 '), TextSpan( text: serviceName, style: const TextStyle( fontWeight: FontWeight.w600, color: AppColors.textPrimary, ), ), const TextSpan(text: ' 구독을\n삭제하시겠습니까?'), ], ), ), const SizedBox(height: 8), // 경고 메시지 Container( padding: const EdgeInsets.symmetric( horizontal: 16, vertical: 12, ), decoration: BoxDecoration( color: Colors.red.withValues(alpha: 0.05), borderRadius: BorderRadius.circular(12), border: Border.all( color: Colors.red.withValues(alpha: 0.2), width: 1, ), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon( Icons.warning_amber_rounded, color: Colors.red.withValues(alpha: 0.8), size: 20, ), const SizedBox(width: 8), const Text( '이 작업은 되돌릴 수 없습니다', style: TextStyle( fontSize: 14, color: Colors.red, fontWeight: FontWeight.w500, ), ), ], ), ), const SizedBox(height: 32), // 버튼들 Row( children: [ Expanded( child: SecondaryButton( text: '취소', onPressed: () { Navigator.of(context).pop(false); }, ), ), const SizedBox(width: 12), Expanded( child: PrimaryButton( text: '삭제', icon: Icons.delete_rounded, onPressed: () { Navigator.of(context).pop(true); }, backgroundColor: Colors.red, ), ), ], ), ], ), ), ), ), ], ), ), ); } /// 삭제 확인 다이얼로그를 표시합니다. static Future show({ required BuildContext context, required String serviceName, }) async { final result = await showDialog( context: context, barrierDismissible: false, barrierColor: Colors.black.withValues(alpha: 0.5), builder: (context) => DeleteConfirmationDialog( serviceName: serviceName, ), ); return result ?? false; } }