feat: 다국어 지원 및 다중 통화 환율 변환 기능 확대
- ExchangeRateService에 JPY, CNY 환율 지원 추가 - 구독 서비스별 다국어 표시 이름 지원 - 분석 화면 차트 및 UI/UX 개선 - 설정 화면 전면 리팩토링 - SMS 스캔 기능 사용성 개선 - 전체 앱 다국어 번역 확대 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../providers/subscription_provider.dart';
|
||||
import '../providers/locale_provider.dart';
|
||||
import '../widgets/native_ad_widget.dart';
|
||||
import '../widgets/analysis/analysis_screen_spacer.dart';
|
||||
import '../widgets/analysis/subscription_pie_chart_card.dart';
|
||||
@@ -22,8 +23,8 @@ class _AnalysisScreenState extends State<AnalysisScreen>
|
||||
|
||||
double _totalExpense = 0;
|
||||
List<Map<String, dynamic>> _monthlyData = [];
|
||||
int _touchedIndex = -1;
|
||||
bool _isLoading = true;
|
||||
String _lastDataHash = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -36,6 +37,23 @@ class _AnalysisScreenState extends State<AnalysisScreen>
|
||||
_loadData();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
// Provider 변경 감지
|
||||
final provider = Provider.of<SubscriptionProvider>(context);
|
||||
final currentHash = _calculateDataHash(provider);
|
||||
|
||||
debugPrint('[AnalysisScreen] didChangeDependencies: '
|
||||
'현재 해시=$currentHash, 이전 해시=$_lastDataHash, 로딩중=$_isLoading');
|
||||
|
||||
// 데이터가 변경되었고 현재 로딩 중이 아닌 경우에만 리로드
|
||||
if (currentHash != _lastDataHash && !_isLoading && _lastDataHash.isNotEmpty) {
|
||||
debugPrint('[AnalysisScreen] 데이터 변경 감지됨, 리로드 시작');
|
||||
_loadData();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animationController.dispose();
|
||||
@@ -43,24 +61,50 @@ class _AnalysisScreenState extends State<AnalysisScreen>
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// 구독 데이터의 해시값을 계산하여 변경 감지
|
||||
String _calculateDataHash(SubscriptionProvider provider) {
|
||||
final subscriptions = provider.subscriptions;
|
||||
final buffer = StringBuffer();
|
||||
|
||||
buffer.write(subscriptions.length);
|
||||
buffer.write('_');
|
||||
buffer.write(provider.totalMonthlyExpense.toStringAsFixed(2));
|
||||
|
||||
for (final sub in subscriptions) {
|
||||
buffer.write('_${sub.id}_${sub.currentPrice.toStringAsFixed(2)}_${sub.currency}');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
Future<void> _loadData() async {
|
||||
debugPrint('[AnalysisScreen] _loadData 호출됨');
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
|
||||
final provider = Provider.of<SubscriptionProvider>(context, listen: false);
|
||||
final localeProvider = Provider.of<LocaleProvider>(context, listen: false);
|
||||
final locale = localeProvider.locale.languageCode;
|
||||
|
||||
// 총 지출 계산
|
||||
_totalExpense = await provider.calculateTotalExpense();
|
||||
// 총 지출 계산 (로케일별 기본 통화로 환산)
|
||||
_totalExpense = await provider.calculateTotalExpense(locale: locale);
|
||||
debugPrint('[AnalysisScreen] 총 지출 계산 완료: $_totalExpense');
|
||||
|
||||
// 월별 데이터 계산
|
||||
_monthlyData = await provider.getMonthlyExpenseData();
|
||||
// 월별 데이터 계산 (로케일별 기본 통화로 환산)
|
||||
_monthlyData = await provider.getMonthlyExpenseData(locale: locale);
|
||||
debugPrint('[AnalysisScreen] 월별 데이터 계산 완료: ${_monthlyData.length}개월');
|
||||
|
||||
// 현재 데이터 해시값 저장
|
||||
_lastDataHash = _calculateDataHash(provider);
|
||||
debugPrint('[AnalysisScreen] 데이터 해시값 저장: $_lastDataHash');
|
||||
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
|
||||
// 데이터 로드 완료 후 애니메이션 시작
|
||||
_animationController.reset();
|
||||
_animationController.forward();
|
||||
}
|
||||
|
||||
@@ -85,74 +129,72 @@ class _AnalysisScreenState extends State<AnalysisScreen>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<SubscriptionProvider>(
|
||||
builder: (context, provider, child) {
|
||||
final subscriptions = provider.subscriptions;
|
||||
// Provider를 직접 사용하여 변경 감지
|
||||
final provider = Provider.of<SubscriptionProvider>(context);
|
||||
final subscriptions = provider.subscriptions;
|
||||
|
||||
if (_isLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
if (_isLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
return CustomScrollView(
|
||||
controller: _scrollController,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: kToolbarHeight + MediaQuery.of(context).padding.top,
|
||||
),
|
||||
),
|
||||
|
||||
// 네이티브 광고 위젯
|
||||
SliverToBoxAdapter(
|
||||
child: _buildAnimatedAd(),
|
||||
),
|
||||
return CustomScrollView(
|
||||
controller: _scrollController,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: kToolbarHeight + MediaQuery.of(context).padding.top,
|
||||
),
|
||||
),
|
||||
|
||||
// 네이티브 광고 위젯
|
||||
SliverToBoxAdapter(
|
||||
child: _buildAnimatedAd(),
|
||||
),
|
||||
|
||||
const AnalysisScreenSpacer(),
|
||||
const AnalysisScreenSpacer(),
|
||||
|
||||
// 1. 구독 비율 파이 차트
|
||||
SubscriptionPieChartCard(
|
||||
subscriptions: subscriptions,
|
||||
animationController: _animationController,
|
||||
touchedIndex: _touchedIndex,
|
||||
onPieTouch: (index) => setState(() => _touchedIndex = index),
|
||||
),
|
||||
// 1. 구독 비율 파이 차트
|
||||
SubscriptionPieChartCard(
|
||||
subscriptions: subscriptions,
|
||||
animationController: _animationController,
|
||||
),
|
||||
|
||||
const AnalysisScreenSpacer(),
|
||||
const AnalysisScreenSpacer(),
|
||||
|
||||
// 2. 총 지출 요약 카드
|
||||
TotalExpenseSummaryCard(
|
||||
subscriptions: subscriptions,
|
||||
totalExpense: _totalExpense,
|
||||
animationController: _animationController,
|
||||
),
|
||||
// 2. 총 지출 요약 카드
|
||||
TotalExpenseSummaryCard(
|
||||
key: ValueKey('total_expense_${_lastDataHash}'),
|
||||
subscriptions: subscriptions,
|
||||
totalExpense: _totalExpense,
|
||||
animationController: _animationController,
|
||||
),
|
||||
|
||||
const AnalysisScreenSpacer(),
|
||||
const AnalysisScreenSpacer(),
|
||||
|
||||
// 3. 월별 지출 차트
|
||||
MonthlyExpenseChartCard(
|
||||
monthlyData: _monthlyData,
|
||||
animationController: _animationController,
|
||||
),
|
||||
// 3. 월별 지출 차트
|
||||
MonthlyExpenseChartCard(
|
||||
key: ValueKey('monthly_expense_${_lastDataHash}'),
|
||||
monthlyData: _monthlyData,
|
||||
animationController: _animationController,
|
||||
),
|
||||
|
||||
const AnalysisScreenSpacer(),
|
||||
const AnalysisScreenSpacer(),
|
||||
|
||||
// 4. 이벤트 분석
|
||||
EventAnalysisCard(
|
||||
animationController: _animationController,
|
||||
),
|
||||
// 4. 이벤트 분석
|
||||
EventAnalysisCard(
|
||||
animationController: _animationController,
|
||||
),
|
||||
|
||||
// FloatingNavigationBar를 위한 충분한 하단 여백
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 120 + MediaQuery.of(context).padding.bottom,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
// FloatingNavigationBar를 위한 충분한 하단 여백
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 120 + MediaQuery.of(context).padding.bottom,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../providers/category_provider.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class CategoryManagementScreen extends StatefulWidget {
|
||||
const CategoryManagementScreen({super.key});
|
||||
@@ -89,15 +90,15 @@ class _CategoryManagementScreenState extends State<CategoryManagementScreen> {
|
||||
),
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: '#1976D2', child: Text('파란색', style: TextStyle(color: AppColors.darkNavy))),
|
||||
value: '#1976D2', child: Text(AppLocalizations.of(context).colorBlue, style: TextStyle(color: AppColors.darkNavy))),
|
||||
DropdownMenuItem(
|
||||
value: '#4CAF50', child: Text('초록색', style: TextStyle(color: AppColors.darkNavy))),
|
||||
value: '#4CAF50', child: Text(AppLocalizations.of(context).colorGreen, style: TextStyle(color: AppColors.darkNavy))),
|
||||
DropdownMenuItem(
|
||||
value: '#FF9800', child: Text('주황색', style: TextStyle(color: AppColors.darkNavy))),
|
||||
value: '#FF9800', child: Text(AppLocalizations.of(context).colorOrange, style: TextStyle(color: AppColors.darkNavy))),
|
||||
DropdownMenuItem(
|
||||
value: '#F44336', child: Text('빨간색', style: TextStyle(color: AppColors.darkNavy))),
|
||||
value: '#F44336', child: Text(AppLocalizations.of(context).colorRed, style: TextStyle(color: AppColors.darkNavy))),
|
||||
DropdownMenuItem(
|
||||
value: '#9C27B0', child: Text('보라색', style: TextStyle(color: AppColors.darkNavy))),
|
||||
value: '#9C27B0', child: Text(AppLocalizations.of(context).colorPurple, style: TextStyle(color: AppColors.darkNavy))),
|
||||
],
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
@@ -162,7 +163,7 @@ class _CategoryManagementScreenState extends State<CategoryManagementScreen> {
|
||||
int.parse(category.color.replaceAll('#', '0xFF'))),
|
||||
),
|
||||
title: Text(
|
||||
category.name,
|
||||
provider.getLocalizedCategoryName(context, category.name),
|
||||
style: TextStyle(
|
||||
color: AppColors.darkNavy,
|
||||
),
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../widgets/detail/detail_event_section.dart';
|
||||
import '../widgets/detail/detail_url_section.dart';
|
||||
import '../widgets/detail/detail_action_buttons.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
/// 구독 상세 정보를 표시하고 편집할 수 있는 화면
|
||||
class DetailScreen extends StatefulWidget {
|
||||
@@ -100,7 +101,7 @@ class _DetailScreenState extends State<DetailScreen>
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'편집 모드',
|
||||
AppLocalizations.of(context).editMode,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -109,7 +110,7 @@ class _DetailScreenState extends State<DetailScreen>
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'변경사항은 저장 후 적용됩니다',
|
||||
AppLocalizations.of(context).changesAppliedAfterSave,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.darkNavy,
|
||||
|
||||
@@ -13,6 +13,7 @@ import '../utils/animation_controller_helper.dart';
|
||||
import '../widgets/floating_navigation_bar.dart';
|
||||
import '../widgets/glassmorphic_scaffold.dart';
|
||||
import '../widgets/home_content.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class MainScreen extends StatefulWidget {
|
||||
const MainScreen({super.key});
|
||||
@@ -162,17 +163,17 @@ class _MainScreenState extends State<MainScreen>
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Row(
|
||||
content: Row(
|
||||
children: [
|
||||
Icon(
|
||||
const Icon(
|
||||
Icons.check_circle,
|
||||
color: AppColors.pureWhite,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'구독이 추가되었습니다',
|
||||
style: TextStyle(
|
||||
AppLocalizations.of(context).subscriptionAdded,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.pureWhite,
|
||||
|
||||
@@ -5,12 +5,13 @@ import '../providers/notification_provider.dart';
|
||||
import 'dart:io';
|
||||
import '../services/notification_service.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../providers/theme_provider.dart';
|
||||
import '../theme/adaptive_theme.dart';
|
||||
import '../widgets/glassmorphism_card.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../widgets/native_ad_widget.dart';
|
||||
import '../widgets/common/snackbar/app_snackbar.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../providers/locale_provider.dart';
|
||||
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
const SettingsScreen({super.key});
|
||||
@@ -83,6 +84,99 @@ class SettingsScreen extends StatelessWidget {
|
||||
// 광고 위젯 추가
|
||||
const NativeAdWidget(key: ValueKey('settings_ad')),
|
||||
const SizedBox(height: 16),
|
||||
// 언어 설정
|
||||
GlassmorphismCard(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Consumer<LocaleProvider>(
|
||||
builder: (context, localeProvider, child) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return ListTile(
|
||||
title: Text(
|
||||
loc.language,
|
||||
style: const TextStyle(color: AppColors.textPrimary),
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.language,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
trailing: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color:
|
||||
AppColors.textSecondary.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
child: DropdownButton<String>(
|
||||
value: localeProvider.locale.languageCode,
|
||||
underline: const SizedBox(),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
dropdownColor: const Color(0xFF2A2A2A), // 어두운 배경색 설정
|
||||
icon: const Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
iconEnabledColor: AppColors.textPrimary,
|
||||
selectedItemBuilder: (BuildContext context) {
|
||||
return [
|
||||
Text(loc.korean,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary)),
|
||||
Text(loc.english,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary)),
|
||||
Text(loc.japanese,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary)),
|
||||
Text(loc.chinese,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary)),
|
||||
];
|
||||
},
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 'ko',
|
||||
child: Text(
|
||||
loc.korean,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'en',
|
||||
child: Text(
|
||||
loc.english,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'ja',
|
||||
child: Text(
|
||||
loc.japanese,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'zh',
|
||||
child: Text(
|
||||
loc.chinese,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (String? value) {
|
||||
if (value != null) {
|
||||
localeProvider.setLocale(value);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// 앱 잠금 설정 UI 숨김
|
||||
// Card(
|
||||
// margin: const EdgeInsets.all(16),
|
||||
@@ -116,13 +210,16 @@ class SettingsScreen extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: const Text(
|
||||
'알림 권한',
|
||||
style: TextStyle(color: AppColors.textPrimary),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).notificationPermission,
|
||||
style:
|
||||
const TextStyle(color: AppColors.textPrimary),
|
||||
),
|
||||
subtitle: const Text(
|
||||
'알림을 받으려면 권한이 필요합니다',
|
||||
style: TextStyle(color: AppColors.textSecondary),
|
||||
subtitle: Text(
|
||||
AppLocalizations.of(context)
|
||||
.notificationPermissionDesc,
|
||||
style:
|
||||
const TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
trailing: ElevatedButton(
|
||||
onPressed: () async {
|
||||
@@ -133,23 +230,28 @@ class SettingsScreen extends StatelessWidget {
|
||||
} else {
|
||||
AppSnackBar.showError(
|
||||
context: context,
|
||||
message: '알림 권한이 거부되었습니다',
|
||||
message: AppLocalizations.of(context)
|
||||
.notificationPermissionDenied,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('권한 요청'),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).requestPermission),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
// 결제 예정 알림 기본 스위치
|
||||
SwitchListTile(
|
||||
title: const Text(
|
||||
'결제 예정 알림',
|
||||
style: TextStyle(color: AppColors.textPrimary),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).paymentNotification,
|
||||
style:
|
||||
const TextStyle(color: AppColors.textPrimary),
|
||||
),
|
||||
subtitle: const Text(
|
||||
'결제 예정일 알림 받기',
|
||||
style: TextStyle(color: AppColors.textSecondary),
|
||||
subtitle: Text(
|
||||
AppLocalizations.of(context)
|
||||
.paymentNotificationDesc,
|
||||
style:
|
||||
const TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
value: provider.isPaymentEnabled,
|
||||
onChanged: (value) {
|
||||
@@ -181,8 +283,10 @@ class SettingsScreen extends StatelessWidget {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 알림 시점 선택 (1일전, 2일전, 3일전)
|
||||
const Text('알림 시점',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(context)
|
||||
.notificationTiming,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 8),
|
||||
Padding(
|
||||
@@ -192,12 +296,24 @@ class SettingsScreen extends StatelessWidget {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_buildReminderDayRadio(context,
|
||||
provider, 1, '1일 전'),
|
||||
_buildReminderDayRadio(context,
|
||||
provider, 2, '2일 전'),
|
||||
_buildReminderDayRadio(context,
|
||||
provider, 3, '3일 전'),
|
||||
_buildReminderDayRadio(
|
||||
context,
|
||||
provider,
|
||||
1,
|
||||
AppLocalizations.of(context)
|
||||
.oneDayBefore),
|
||||
_buildReminderDayRadio(
|
||||
context,
|
||||
provider,
|
||||
2,
|
||||
AppLocalizations.of(context)
|
||||
.twoDaysBefore),
|
||||
_buildReminderDayRadio(
|
||||
context,
|
||||
provider,
|
||||
3,
|
||||
AppLocalizations.of(context)
|
||||
.threeDaysBefore),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -205,8 +321,10 @@ class SettingsScreen extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 알림 시간 선택
|
||||
const Text('알림 시간',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(context)
|
||||
.notificationTime,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 12),
|
||||
InkWell(
|
||||
@@ -304,13 +422,21 @@ class SettingsScreen extends StatelessWidget {
|
||||
const EdgeInsets
|
||||
.symmetric(
|
||||
horizontal: 12),
|
||||
title:
|
||||
const Text('1일마다 반복 알림'),
|
||||
title: Text(
|
||||
AppLocalizations.of(
|
||||
context)
|
||||
.dailyReminder),
|
||||
subtitle: Text(
|
||||
provider.isDailyReminderEnabled
|
||||
? '결제일까지 매일 알림을 받습니다'
|
||||
: '결제 ${provider.reminderDays}일 전에 알림을 받습니다',
|
||||
style: TextStyle(
|
||||
? AppLocalizations.of(
|
||||
context)
|
||||
.dailyReminderEnabled
|
||||
: AppLocalizations.of(
|
||||
context)
|
||||
.dailyReminderDisabledWithDays(
|
||||
provider
|
||||
.reminderDays),
|
||||
style: const TextStyle(
|
||||
color: AppColors
|
||||
.textLight),
|
||||
),
|
||||
@@ -355,13 +481,13 @@ class SettingsScreen extends StatelessWidget {
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ListTile(
|
||||
title: const Text(
|
||||
'앱 정보',
|
||||
style: TextStyle(color: AppColors.textPrimary),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).appInfo,
|
||||
style: const TextStyle(color: AppColors.textPrimary),
|
||||
),
|
||||
subtitle: const Text(
|
||||
'버전 1.0.0',
|
||||
style: TextStyle(color: AppColors.textSecondary),
|
||||
subtitle: Text(
|
||||
'${AppLocalizations.of(context).version} 1.0.0',
|
||||
style: const TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.info,
|
||||
@@ -372,13 +498,14 @@ class SettingsScreen extends StatelessWidget {
|
||||
if (kIsWeb) {
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: 'Digital Rent Manager',
|
||||
applicationName: AppLocalizations.of(context).appTitle,
|
||||
applicationVersion: '1.0.0',
|
||||
applicationIcon: const FlutterLogo(size: 50),
|
||||
children: [
|
||||
const Text('디지털 월세 관리 앱'),
|
||||
Text(AppLocalizations.of(context).appDescription),
|
||||
const SizedBox(height: 8),
|
||||
const Text('개발자: Julian Sul'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context).developer}: Julian Sul'),
|
||||
],
|
||||
);
|
||||
return;
|
||||
@@ -407,7 +534,8 @@ class SettingsScreen extends StatelessWidget {
|
||||
if (context.mounted) {
|
||||
AppSnackBar.showError(
|
||||
context: context,
|
||||
message: '스토어를 열 수 없습니다',
|
||||
message:
|
||||
AppLocalizations.of(context).cannotOpenStore,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -415,13 +543,14 @@ class SettingsScreen extends StatelessWidget {
|
||||
// 스토어 링크를 열 수 없는 경우 기존 정보 다이얼로그 표시
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: 'SubManager',
|
||||
applicationName: AppLocalizations.of(context).appTitle,
|
||||
applicationVersion: '1.0.0',
|
||||
applicationIcon: const FlutterLogo(size: 50),
|
||||
children: [
|
||||
const Text('구독 관리 앱'),
|
||||
Text(AppLocalizations.of(context).appDescription),
|
||||
const SizedBox(height: 8),
|
||||
const Text('개발자: SubManager Team'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context).developer}: Julian Sul'),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -438,30 +567,4 @@ class SettingsScreen extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
String _getThemeModeText(AppThemeMode mode) {
|
||||
switch (mode) {
|
||||
case AppThemeMode.light:
|
||||
return '라이트';
|
||||
case AppThemeMode.dark:
|
||||
return '다크';
|
||||
case AppThemeMode.oled:
|
||||
return 'OLED 블랙';
|
||||
case AppThemeMode.system:
|
||||
return '시스템 설정';
|
||||
}
|
||||
}
|
||||
|
||||
IconData _getThemeModeIcon(AppThemeMode mode) {
|
||||
switch (mode) {
|
||||
case AppThemeMode.light:
|
||||
return Icons.light_mode;
|
||||
case AppThemeMode.dark:
|
||||
return Icons.dark_mode;
|
||||
case AppThemeMode.oled:
|
||||
return Icons.phonelink_lock;
|
||||
case AppThemeMode.system:
|
||||
return Icons.settings_brightness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ import 'package:flutter/material.dart';
|
||||
import '../services/sms_scanner.dart';
|
||||
import '../providers/subscription_provider.dart';
|
||||
import '../providers/navigation_provider.dart';
|
||||
import '../providers/locale_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../models/subscription.dart';
|
||||
import '../models/subscription_model.dart';
|
||||
import '../services/subscription_url_matcher.dart';
|
||||
import '../services/currency_util.dart';
|
||||
import 'package:intl/intl.dart'; // NumberFormat을 사용하기 위한 import 추가
|
||||
import '../widgets/glassmorphism_card.dart';
|
||||
import '../widgets/themed_text.dart';
|
||||
@@ -18,6 +20,7 @@ import '../providers/category_provider.dart';
|
||||
import '../models/category_model.dart';
|
||||
import '../widgets/common/form_fields/category_selector.dart';
|
||||
import '../widgets/native_ad_widget.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class SmsScanScreen extends StatefulWidget {
|
||||
const SmsScanScreen({super.key});
|
||||
@@ -75,7 +78,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (scannedSubscriptionModels.isEmpty) {
|
||||
print('스캔된 구독이 없음');
|
||||
setState(() {
|
||||
_errorMessage = '구독 정보를 찾을 수 없습니다.';
|
||||
_errorMessage = AppLocalizations.of(context).subscriptionNotFound;
|
||||
_isLoading = false;
|
||||
});
|
||||
return;
|
||||
@@ -98,7 +101,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (repeatSubscriptions.isEmpty) {
|
||||
print('반복 결제된 구독이 없음');
|
||||
setState(() {
|
||||
_errorMessage = '반복 결제된 구독 정보를 찾을 수 없습니다.';
|
||||
_errorMessage = AppLocalizations.of(context).repeatSubscriptionNotFound;
|
||||
_isLoading = false;
|
||||
});
|
||||
return;
|
||||
@@ -131,7 +134,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showInfo(
|
||||
context: context,
|
||||
message: '신규 구독 관련 SMS를 찾을 수 없습니다',
|
||||
message: AppLocalizations.of(context).newSubscriptionNotFound,
|
||||
icon: Icons.search_off_rounded,
|
||||
);
|
||||
}
|
||||
@@ -148,7 +151,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
print('SMS 스캔 중 오류 발생: $e');
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_errorMessage = 'SMS 스캔 중 오류가 발생했습니다: $e';
|
||||
_errorMessage = AppLocalizations.of(context).smsScanErrorWithMessage(e.toString());
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
@@ -389,7 +392,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showSuccess(
|
||||
context: context,
|
||||
message: '${subscription.serviceName} 구독이 추가되었습니다.',
|
||||
message: AppLocalizations.of(context).subscriptionAddedWithName(subscription.serviceName),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -400,7 +403,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showError(
|
||||
context: context,
|
||||
message: '구독 추가 중 오류가 발생했습니다: $e',
|
||||
message: AppLocalizations.of(context).subscriptionAddErrorWithMessage(e.toString()),
|
||||
);
|
||||
|
||||
// 오류가 있어도 다음 구독으로 이동
|
||||
@@ -416,7 +419,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showInfo(
|
||||
context: context,
|
||||
message: '${subscription.serviceName} 구독을 건너뛰었습니다.',
|
||||
message: AppLocalizations.of(context).subscriptionSkipped(subscription.serviceName),
|
||||
icon: Icons.skip_next_rounded,
|
||||
);
|
||||
}
|
||||
@@ -447,7 +450,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
// 완료 메시지 표시
|
||||
AppSnackBar.showSuccess(
|
||||
context: context,
|
||||
message: '모든 구독이 처리되었습니다.',
|
||||
message: AppLocalizations.of(context).allSubscriptionsProcessed,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -482,7 +485,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
}
|
||||
|
||||
final daysUntil = adjusted.difference(now).inDays;
|
||||
return '다음 예상 결제일: ${_formatDate(adjusted)} ($daysUntil일 후)';
|
||||
return AppLocalizations.of(context).nextBillingDateEstimated(AppLocalizations.of(context).formatDate(adjusted), daysUntil);
|
||||
} else if (subscription.billingCycle == '연간') {
|
||||
// 올해 또는 내년 같은 날짜
|
||||
int day = date.day;
|
||||
@@ -503,14 +506,14 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
}
|
||||
|
||||
final daysUntil = adjusted.difference(now).inDays;
|
||||
return '다음 예상 결제일: ${_formatDate(adjusted)} ($daysUntil일 후)';
|
||||
return AppLocalizations.of(context).nextBillingDateEstimated(AppLocalizations.of(context).formatDate(adjusted), daysUntil);
|
||||
} else {
|
||||
return '다음 결제일 확인 필요 (과거 날짜)';
|
||||
}
|
||||
} else {
|
||||
// 미래 날짜인 경우
|
||||
final daysUntil = date.difference(now).inDays;
|
||||
return '다음 결제일: ${_formatDate(date)} ($daysUntil일 후)';
|
||||
return AppLocalizations.of(context).nextBillingDateInfo(AppLocalizations.of(context).formatDate(date), daysUntil);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +524,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
|
||||
// 결제 반복 횟수 텍스트
|
||||
String _getRepeatCountText(int count) {
|
||||
return '$count회 결제 감지됨';
|
||||
return AppLocalizations.of(context).repeatCountDetected(count);
|
||||
}
|
||||
|
||||
// 카테고리 칩 빌드
|
||||
@@ -532,7 +535,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
|
||||
// 카테고리가 없으면 기타 카테고리 찾기
|
||||
final defaultCategory = category ?? categoryProvider.categories.firstWhere(
|
||||
(cat) => cat.name == '기타',
|
||||
(cat) => cat.name == 'other',
|
||||
orElse: () => categoryProvider.categories.first,
|
||||
);
|
||||
|
||||
@@ -553,7 +556,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
ThemedText(
|
||||
defaultCategory.name,
|
||||
categoryProvider.getLocalizedCategoryName(context, defaultCategory.name),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
forceDark: true,
|
||||
@@ -567,25 +570,25 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
// 카테고리 아이콘 반환
|
||||
IconData _getCategoryIcon(CategoryModel category) {
|
||||
switch (category.name) {
|
||||
case '음악':
|
||||
case 'music':
|
||||
return Icons.music_note_rounded;
|
||||
case 'OTT(동영상)':
|
||||
case 'ottVideo':
|
||||
return Icons.movie_filter_rounded;
|
||||
case '저장/클라우드':
|
||||
case 'storageCloud':
|
||||
return Icons.cloud_outlined;
|
||||
case '통신 · 인터넷 · TV':
|
||||
case 'telecomInternetTv':
|
||||
return Icons.wifi_rounded;
|
||||
case '생활/라이프스타일':
|
||||
case 'lifestyle':
|
||||
return Icons.home_outlined;
|
||||
case '쇼핑/이커머스':
|
||||
case 'shoppingEcommerce':
|
||||
return Icons.shopping_cart_outlined;
|
||||
case '프로그래밍':
|
||||
case 'programming':
|
||||
return Icons.code_rounded;
|
||||
case '협업/오피스':
|
||||
case 'collaborationOffice':
|
||||
return Icons.business_center_outlined;
|
||||
case 'AI 서비스':
|
||||
case 'aiService':
|
||||
return Icons.smart_toy_outlined;
|
||||
case '기타':
|
||||
case 'other':
|
||||
default:
|
||||
return Icons.category_outlined;
|
||||
}
|
||||
@@ -595,7 +598,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
String _getDefaultCategoryId() {
|
||||
final categoryProvider = Provider.of<CategoryProvider>(context, listen: false);
|
||||
final otherCategory = categoryProvider.categories.firstWhere(
|
||||
(cat) => cat.name == '기타',
|
||||
(cat) => cat.name == 'other',
|
||||
orElse: () => categoryProvider.categories.first, // 만약 "기타"가 없으면 첫 번째 카테고리
|
||||
);
|
||||
print('기본 카테고리 설정: ${otherCategory.name} (ID: ${otherCategory.id})');
|
||||
@@ -638,9 +641,9 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppColors.primaryColor),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const ThemedText('SMS 메시지를 스캔 중입니다...', forceDark: true),
|
||||
ThemedText(AppLocalizations.of(context).scanningMessages, forceDark: true),
|
||||
const SizedBox(height: 8),
|
||||
const ThemedText('구독 서비스를 찾고 있습니다', opacity: 0.7, forceDark: true),
|
||||
ThemedText(AppLocalizations.of(context).findingSubscriptions, opacity: 0.7, forceDark: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -668,17 +671,17 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
const ThemedText(
|
||||
'2회 이상 결제된 구독 서비스 찾기',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).findRepeatSubscriptions,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: ThemedText(
|
||||
'문자 메시지를 스캔하여 반복적으로 결제된 구독 서비스를 자동으로 찾습니다. 서비스명과 금액을 추출하여 쉽게 구독을 추가할 수 있습니다.',
|
||||
AppLocalizations.of(context).scanTextMessages,
|
||||
textAlign: TextAlign.center,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -686,7 +689,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
PrimaryButton(
|
||||
text: '스캔 시작하기',
|
||||
text: AppLocalizations.of(context).startScanning,
|
||||
icon: Icons.search_rounded,
|
||||
onPressed: _scanSms,
|
||||
width: 200,
|
||||
@@ -751,16 +754,16 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ThemedText(
|
||||
'다음 구독을 찾았습니다',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).foundSubscription,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// 서비스명
|
||||
const ThemedText(
|
||||
'서비스명',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).serviceName,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -781,28 +784,28 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ThemedText(
|
||||
'월 비용',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).monthlyCost,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ThemedText(
|
||||
subscription.currency == 'USD'
|
||||
? NumberFormat.currency(
|
||||
locale: 'en_US',
|
||||
symbol: '\$',
|
||||
decimalDigits: 2,
|
||||
).format(subscription.monthlyCost)
|
||||
: NumberFormat.currency(
|
||||
locale: 'ko_KR',
|
||||
symbol: '₩',
|
||||
decimalDigits: 0,
|
||||
).format(subscription.monthlyCost),
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
// 언어별 통화 표시
|
||||
FutureBuilder<String>(
|
||||
future: CurrencyUtil.formatAmountWithLocale(
|
||||
subscription.monthlyCost,
|
||||
subscription.currency,
|
||||
context.read<LocaleProvider>().locale.languageCode,
|
||||
),
|
||||
builder: (context, snapshot) {
|
||||
return ThemedText(
|
||||
snapshot.data ?? '-',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -811,8 +814,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ThemedText(
|
||||
'결제 주기',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).billingCycle,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -832,8 +835,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 다음 결제일
|
||||
const ThemedText(
|
||||
'다음 결제일',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).nextBillingDateLabel,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -848,8 +851,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 카테고리 선택
|
||||
const ThemedText(
|
||||
'카테고리',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).category,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -877,8 +880,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
// 웹사이트 URL 입력 필드 추가/수정
|
||||
BaseTextField(
|
||||
controller: _websiteUrlController,
|
||||
label: '웹사이트 URL (자동 추출됨)',
|
||||
hintText: '웹사이트 URL을 수정하거나 비워두세요',
|
||||
label: AppLocalizations.of(context).websiteUrlAuto,
|
||||
hintText: AppLocalizations.of(context).websiteUrlHint,
|
||||
prefixIcon: Icon(
|
||||
Icons.language,
|
||||
color: AppColors.navyGray,
|
||||
@@ -895,7 +898,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SecondaryButton(
|
||||
text: '건너뛰기',
|
||||
text: AppLocalizations.of(context).skip,
|
||||
onPressed: _skipCurrentSubscription,
|
||||
height: 48,
|
||||
),
|
||||
@@ -903,7 +906,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: PrimaryButton(
|
||||
text: '추가하기',
|
||||
text: AppLocalizations.of(context).add,
|
||||
onPressed: _addCurrentSubscription,
|
||||
height: 48,
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../routes/app_routes.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
const SplashScreen({super.key});
|
||||
@@ -323,7 +324,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'Digital Rent Manager',
|
||||
AppLocalizations.of(context).appTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -350,7 +351,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'구독 서비스 관리를 더 쉽게',
|
||||
AppLocalizations.of(context).appSubtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: AppColors.primaryColor
|
||||
|
||||
Reference in New Issue
Block a user