import 'package:flutter/material.dart'; import '../../../theme/app_colors.dart'; /// 통화 선택 위젯 /// KRW(원화)와 USD(달러) 중 선택할 수 있습니다. class CurrencySelector extends StatelessWidget { final String currency; final ValueChanged onChanged; final bool isGlassmorphism; const CurrencySelector({ super.key, required this.currency, required this.onChanged, this.isGlassmorphism = false, }); @override Widget build(BuildContext context) { return Row( children: [ _CurrencyOption( label: '₩', value: 'KRW', isSelected: currency == 'KRW', onTap: () => onChanged('KRW'), isGlassmorphism: isGlassmorphism, ), const SizedBox(width: 8), _CurrencyOption( label: '\$', value: 'USD', isSelected: currency == 'USD', onTap: () => onChanged('USD'), isGlassmorphism: isGlassmorphism, ), ], ); } } /// 통화 옵션 버튼 class _CurrencyOption extends StatelessWidget { final String label; final String value; final bool isSelected; final VoidCallback onTap; final bool isGlassmorphism; const _CurrencyOption({ required this.label, required this.value, required this.isSelected, required this.onTap, required this.isGlassmorphism, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Expanded( child: InkWell( onTap: onTap, borderRadius: BorderRadius.circular(12), child: Container( padding: const EdgeInsets.symmetric(vertical: 12), decoration: BoxDecoration( color: _getBackgroundColor(theme), borderRadius: BorderRadius.circular(12), border: _getBorder(), ), child: Center( child: Text( label, style: TextStyle( fontSize: 18, fontWeight: FontWeight.w600, color: _getTextColor(), ), ), ), ), ), ); } Color _getBackgroundColor(ThemeData theme) { if (isSelected) { return isGlassmorphism ? theme.primaryColor : const Color(0xFF3B82F6); } return isGlassmorphism ? AppColors.surfaceColorAlt : Colors.grey.withValues(alpha: 0.1); } Border? _getBorder() { if (isSelected || !isGlassmorphism) { return null; } return Border.all( color: AppColors.borderColor, width: 1.5, ); } Color _getTextColor() { if (isSelected) { return Colors.white; } return isGlassmorphism ? AppColors.navyGray : Colors.grey[600]!; } }