style: apply dart format across project
This commit is contained in:
@@ -69,13 +69,17 @@ class AnalysisBadge extends StatelessWidget {
|
||||
String displayText = amountText;
|
||||
if (amountText.length > 12) {
|
||||
// 괄호 안의 내용 제거
|
||||
displayText = amountText.replaceAll(RegExp(r'\([^)]*\)'), '').trim();
|
||||
displayText =
|
||||
amountText.replaceAll(RegExp(r'\([^)]*\)'), '').trim();
|
||||
}
|
||||
if (displayText.length > 10) {
|
||||
// 통화 기호만 남기고 숫자만 표시
|
||||
final currencySymbol = CurrencyUtil.getCurrencySymbol(subscription.currency);
|
||||
displayText = displayText.replaceAll(currencySymbol, '').trim();
|
||||
displayText = '$currencySymbol${displayText.substring(0, 6)}...';
|
||||
final currencySymbol =
|
||||
CurrencyUtil.getCurrencySymbol(subscription.currency);
|
||||
displayText =
|
||||
displayText.replaceAll(currencySymbol, '').trim();
|
||||
displayText =
|
||||
'$currencySymbol${displayText.substring(0, 6)}...';
|
||||
}
|
||||
return Text(
|
||||
displayText,
|
||||
@@ -93,4 +97,4 @@ class AnalysisBadge extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
/// SliverToBoxAdapter 오류를 해결하기 위해 별도 컴포넌트로 분리
|
||||
class AnalysisScreenSpacer extends StatelessWidget {
|
||||
final double height;
|
||||
|
||||
|
||||
const AnalysisScreenSpacer({
|
||||
super.key,
|
||||
this.height = 24,
|
||||
@@ -16,4 +16,4 @@ class AnalysisScreenSpacer extends StatelessWidget {
|
||||
child: SizedBox(height: height),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,10 +48,12 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ThemedText.headline(
|
||||
text: AppLocalizations.of(context).eventDiscountStatus,
|
||||
text: AppLocalizations.of(context)
|
||||
.eventDiscountStatus,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
@@ -79,7 +81,10 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
AppLocalizations.of(context).servicesInProgress(provider.activeEventSubscriptions.length),
|
||||
AppLocalizations.of(context)
|
||||
.servicesInProgress(provider
|
||||
.activeEventSubscriptions
|
||||
.length),
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -97,15 +102,18 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
const Color(0xFFFF6B6B).withValues(alpha: 0.1),
|
||||
const Color(0xFFFF8787).withValues(alpha: 0.1),
|
||||
const Color(0xFFFF6B6B)
|
||||
.withValues(alpha: 0.1),
|
||||
const Color(0xFFFF8787)
|
||||
.withValues(alpha: 0.1),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFF6B6B).withValues(alpha: 0.3),
|
||||
color: const Color(0xFFFF6B6B)
|
||||
.withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -118,10 +126,12 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).monthlySavingAmount,
|
||||
AppLocalizations.of(context)
|
||||
.monthlySavingAmount,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -154,24 +164,29 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
...provider.activeEventSubscriptions.map((sub) {
|
||||
final savings = sub.originalPrice - (sub.eventPrice ?? sub.originalPrice);
|
||||
final discountRate =
|
||||
((savings / sub.originalPrice) * 100).round();
|
||||
final savings = sub.originalPrice -
|
||||
(sub.eventPrice ?? sub.originalPrice);
|
||||
final discountRate =
|
||||
((savings / sub.originalPrice) * 100)
|
||||
.round();
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.darkNavy.withValues(alpha: 0.05),
|
||||
color: AppColors.darkNavy
|
||||
.withValues(alpha: 0.05),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: AppColors.darkNavy.withValues(alpha: 0.1),
|
||||
color: AppColors.darkNavy
|
||||
.withValues(alpha: 0.1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemedText(
|
||||
sub.serviceName,
|
||||
@@ -184,8 +199,8 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
FutureBuilder<String>(
|
||||
future: CurrencyUtil
|
||||
.formatAmount(
|
||||
future:
|
||||
CurrencyUtil.formatAmount(
|
||||
sub.originalPrice,
|
||||
sub.currency),
|
||||
builder: (context, snapshot) {
|
||||
@@ -194,9 +209,11 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
snapshot.data!,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
decoration: TextDecoration
|
||||
.lineThrough,
|
||||
color: AppColors.navyGray,
|
||||
decoration:
|
||||
TextDecoration
|
||||
.lineThrough,
|
||||
color: AppColors
|
||||
.navyGray,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -211,9 +228,10 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FutureBuilder<String>(
|
||||
future: CurrencyUtil
|
||||
.formatAmount(
|
||||
sub.eventPrice ?? sub.originalPrice,
|
||||
future:
|
||||
CurrencyUtil.formatAmount(
|
||||
sub.eventPrice ??
|
||||
sub.originalPrice,
|
||||
sub.currency),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
@@ -244,7 +262,8 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFF6B6B)
|
||||
.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderRadius:
|
||||
BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
'$discountRate${AppLocalizations.of(context).discountPercent}',
|
||||
@@ -271,4 +290,4 @@ class EventAnalysisCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
/// Y축 최대값을 계산합니다 (언어별 통화 단위에 맞춰)
|
||||
double _calculateChartMaxY(double maxValue, String locale) {
|
||||
final currency = CurrencyUtil.getDefaultCurrency(locale);
|
||||
|
||||
|
||||
if (currency == 'KRW' || currency == 'JPY') {
|
||||
// 소수점이 없는 통화 (원화, 엔화)
|
||||
if (maxValue <= 0) return 100000;
|
||||
@@ -33,9 +33,10 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
if (maxValue <= 200000) return 200000;
|
||||
if (maxValue <= 500000) return 500000;
|
||||
if (maxValue <= 1000000) return 1000000;
|
||||
|
||||
|
||||
// 큰 금액은 자릿수에 맞춰 반올림
|
||||
final magnitude = math.pow(10, maxValue.toString().split('.')[0].length - 1).toDouble();
|
||||
final magnitude =
|
||||
math.pow(10, maxValue.toString().split('.')[0].length - 1).toDouble();
|
||||
return ((maxValue / magnitude).ceil() * magnitude).toDouble();
|
||||
} else {
|
||||
// 소수점이 있는 통화 (달러, 위안)
|
||||
@@ -47,7 +48,7 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
if (maxValue <= 250) return 250.0;
|
||||
if (maxValue <= 500) return 500.0;
|
||||
if (maxValue <= 1000) return 1000.0;
|
||||
|
||||
|
||||
// 큰 금액은 100 단위로 반올림
|
||||
return ((maxValue / 100).ceil() * 100).toDouble();
|
||||
}
|
||||
@@ -164,8 +165,7 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
0,
|
||||
(max, data) => math.max(
|
||||
max, data['totalExpense'] as double)),
|
||||
locale
|
||||
),
|
||||
locale),
|
||||
barGroups: _getMonthlyBarGroups(locale),
|
||||
gridData: FlGridData(
|
||||
show: true,
|
||||
@@ -176,13 +176,12 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
0,
|
||||
(max, data) => math.max(max,
|
||||
data['totalExpense'] as double)),
|
||||
locale
|
||||
),
|
||||
CurrencyUtil.getDefaultCurrency(locale)
|
||||
),
|
||||
locale),
|
||||
CurrencyUtil.getDefaultCurrency(locale)),
|
||||
getDrawingHorizontalLine: (value) {
|
||||
return FlLine(
|
||||
color: AppColors.navyGray.withValues(alpha: 0.1),
|
||||
color:
|
||||
AppColors.navyGray.withValues(alpha: 0.1),
|
||||
strokeWidth: 1,
|
||||
);
|
||||
},
|
||||
@@ -233,10 +232,11 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: CurrencyUtil.formatTotalAmountWithLocale(
|
||||
monthlyData[group.x]['totalExpense']
|
||||
as double,
|
||||
locale),
|
||||
text: CurrencyUtil
|
||||
.formatTotalAmountWithLocale(
|
||||
monthlyData[group.x]
|
||||
['totalExpense'] as double,
|
||||
locale),
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFBBF24),
|
||||
fontSize: 14,
|
||||
@@ -254,7 +254,8 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
child: ThemedText.caption(
|
||||
text: AppLocalizations.of(context).monthlySubscriptionExpense,
|
||||
text: AppLocalizations.of(context)
|
||||
.monthlySubscriptionExpense,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -270,4 +271,4 @@ class MonthlyExpenseChartCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,15 @@ class SubscriptionPieChartCard extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
State<SubscriptionPieChartCard> createState() => _SubscriptionPieChartCardState();
|
||||
State<SubscriptionPieChartCard> createState() =>
|
||||
_SubscriptionPieChartCardState();
|
||||
}
|
||||
|
||||
class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
int _touchedIndex = -1;
|
||||
late Future<List<PieChartSectionData>> _pieSectionsFuture;
|
||||
String? _lastLocale;
|
||||
|
||||
|
||||
static const _chartColors = [
|
||||
Color(0xFF3B82F6),
|
||||
Color(0xFF10B981),
|
||||
@@ -52,7 +53,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
// subscriptions나 locale이 변경된 경우만 Future 재생성
|
||||
final currentLocale = context.read<LocaleProvider>().locale.languageCode;
|
||||
if (!_listEquals(oldWidget.subscriptions, widget.subscriptions) ||
|
||||
if (!_listEquals(oldWidget.subscriptions, widget.subscriptions) ||
|
||||
_lastLocale != currentLocale) {
|
||||
_initializeFuture();
|
||||
}
|
||||
@@ -66,7 +67,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
bool _listEquals(List<SubscriptionModel> a, List<SubscriptionModel> b) {
|
||||
if (a.length != b.length) return false;
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (a[i].id != b[i].id ||
|
||||
if (a[i].id != b[i].id ||
|
||||
a[i].currentPrice != b[i].currentPrice ||
|
||||
a[i].currency != b[i].currency ||
|
||||
a[i].serviceName != b[i].serviceName) {
|
||||
@@ -78,7 +79,6 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
|
||||
// 파이 차트 섹션 데이터 (언어별 기본 통화로 환산)
|
||||
Future<List<PieChartSectionData>> _getPieSections() async {
|
||||
|
||||
if (widget.subscriptions.isEmpty) return [];
|
||||
|
||||
// 현재 locale 가져오기
|
||||
@@ -91,17 +91,19 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
// 각 구독의 현재 가격을 언어별 기본 통화로 환산
|
||||
for (var subscription in widget.subscriptions) {
|
||||
double value = subscription.currentPrice;
|
||||
|
||||
|
||||
if (subscription.currency == defaultCurrency) {
|
||||
// 이미 기본 통화인 경우 그대로 사용
|
||||
sectionValues.add(value);
|
||||
} else if (subscription.currency == 'USD') {
|
||||
// USD를 기본 통화로 변환
|
||||
final converted = await ExchangeRateService().convertUsdToTarget(value, defaultCurrency);
|
||||
final converted = await ExchangeRateService()
|
||||
.convertUsdToTarget(value, defaultCurrency);
|
||||
sectionValues.add(converted ?? value);
|
||||
} else if (defaultCurrency == 'USD') {
|
||||
// 기본 통화가 USD인 경우 다른 통화를 USD로 변환
|
||||
final converted = await ExchangeRateService().convertTargetToUsd(value, subscription.currency);
|
||||
final converted = await ExchangeRateService()
|
||||
.convertTargetToUsd(value, subscription.currency);
|
||||
sectionValues.add(converted ?? value);
|
||||
} else {
|
||||
// 기타 통화는 일단 그대로 사용 (환율 정보가 없는 경우)
|
||||
@@ -111,7 +113,7 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
|
||||
// 총합 계산
|
||||
double sectionsTotal = sectionValues.fold(0, (sum, value) => sum + value);
|
||||
|
||||
|
||||
// 총합이 0이면 빈 배열 반환
|
||||
if (sectionsTotal == 0) return [];
|
||||
|
||||
@@ -138,17 +140,17 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
badgePositionPercentageOffset: .98,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
return sections;
|
||||
}
|
||||
|
||||
// 배지 위젯 생성
|
||||
Widget _createBadgeWidget(int index) {
|
||||
if (index >= widget.subscriptions.length) return const SizedBox.shrink();
|
||||
|
||||
|
||||
final subscription = widget.subscriptions[index];
|
||||
final colorIndex = index % _chartColors.length;
|
||||
|
||||
|
||||
return IgnorePointer(
|
||||
child: AnalysisBadge(
|
||||
size: 40,
|
||||
@@ -159,24 +161,27 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
}
|
||||
|
||||
// 터치 상태를 반영한 섹션 데이터 생성
|
||||
List<PieChartSectionData> _applyTouchedState(List<PieChartSectionData> sections) {
|
||||
List<PieChartSectionData> _applyTouchedState(
|
||||
List<PieChartSectionData> sections) {
|
||||
return List.generate(sections.length, (i) {
|
||||
final section = sections[i];
|
||||
final isTouched = _touchedIndex == i;
|
||||
final fontSize = isTouched ? 16.0 : 12.0;
|
||||
final radius = isTouched ? 105.0 : 100.0;
|
||||
|
||||
|
||||
return PieChartSectionData(
|
||||
value: section.value,
|
||||
title: section.title,
|
||||
titleStyle: section.titleStyle?.copyWith(fontSize: fontSize) ?? TextStyle(
|
||||
fontSize: fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.pureWhite,
|
||||
shadows: const [
|
||||
Shadow(color: Colors.black26, blurRadius: 2, offset: Offset(0, 1))
|
||||
],
|
||||
),
|
||||
titleStyle: section.titleStyle?.copyWith(fontSize: fontSize) ??
|
||||
TextStyle(
|
||||
fontSize: fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.pureWhite,
|
||||
shadows: const [
|
||||
Shadow(
|
||||
color: Colors.black26, blurRadius: 2, offset: Offset(0, 1))
|
||||
],
|
||||
),
|
||||
color: section.color,
|
||||
radius: radius,
|
||||
titlePositionPercentageOffset: section.titlePositionPercentageOffset,
|
||||
@@ -217,18 +222,20 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ThemedText.headline(
|
||||
text: AppLocalizations.of(context).subscriptionServiceRatio,
|
||||
text: AppLocalizations.of(context)
|
||||
.subscriptionServiceRatio,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
FutureBuilder<String>(
|
||||
future: CurrencyUtil.getExchangeRateInfoForLocale(
|
||||
context.watch<LocaleProvider>().locale.languageCode
|
||||
),
|
||||
context
|
||||
.watch<LocaleProvider>()
|
||||
.locale
|
||||
.languageCode),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData &&
|
||||
snapshot.data!.isNotEmpty) {
|
||||
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
@@ -236,15 +243,15 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFE5F2FF),
|
||||
borderRadius:
|
||||
BorderRadius.circular(4),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFBFDBFE),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).exchangeRateFormat(snapshot.data!),
|
||||
AppLocalizations.of(context)
|
||||
.exchangeRateFormat(snapshot.data!),
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -272,7 +279,8 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
height: 250,
|
||||
child: Center(
|
||||
child: ThemedText(
|
||||
AppLocalizations.of(context).noSubscriptionServices,
|
||||
AppLocalizations.of(context)
|
||||
.noSubscriptionServices,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
@@ -284,36 +292,41 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
child: FutureBuilder<List<PieChartSectionData>>(
|
||||
future: _pieSectionsFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (!snapshot.hasData || snapshot.data!.isEmpty) {
|
||||
|
||||
if (!snapshot.hasData ||
|
||||
snapshot.data!.isEmpty) {
|
||||
return Center(
|
||||
child: ThemedText(
|
||||
AppLocalizations.of(context).noSubscriptionServices,
|
||||
AppLocalizations.of(context)
|
||||
.noSubscriptionServices,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return PieChart(
|
||||
PieChartData(
|
||||
borderData: FlBorderData(show: false),
|
||||
sectionsSpace: 2,
|
||||
centerSpaceRadius: 60,
|
||||
sections: _applyTouchedState(snapshot.data!),
|
||||
sections:
|
||||
_applyTouchedState(snapshot.data!),
|
||||
pieTouchData: PieTouchData(
|
||||
enabled: true,
|
||||
touchCallback: (FlTouchEvent event,
|
||||
pieTouchResponse) {
|
||||
// 터치 응답이 없거나 섹션이 없는 경우
|
||||
if (pieTouchResponse == null ||
|
||||
pieTouchResponse.touchedSection == null) {
|
||||
pieTouchResponse.touchedSection ==
|
||||
null) {
|
||||
// 차트 밖으로 나갔을 때만 리셋
|
||||
if (_touchedIndex != -1) {
|
||||
setState(() {
|
||||
@@ -322,22 +335,25 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final touchedIndex = pieTouchResponse
|
||||
.touchedSection!
|
||||
.touchedSectionIndex;
|
||||
|
||||
|
||||
// 탭 이벤트 처리 (토글)
|
||||
if (event is FlTapUpEvent) {
|
||||
setState(() {
|
||||
// 동일 섹션 탭하면 선택 해제, 아니면 선택
|
||||
_touchedIndex = (_touchedIndex == touchedIndex) ? -1 : touchedIndex;
|
||||
_touchedIndex = (_touchedIndex ==
|
||||
touchedIndex)
|
||||
? -1
|
||||
: touchedIndex;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// hover 이벤트 처리 (단순 표시)
|
||||
if (event is FlPointerHoverEvent ||
|
||||
if (event is FlPointerHoverEvent ||
|
||||
event is FlPointerEnterEvent) {
|
||||
// 현재 인덱스와 다른 경우만 업데이트
|
||||
if (_touchedIndex != touchedIndex) {
|
||||
@@ -364,10 +380,10 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
(index) {
|
||||
final subscription =
|
||||
widget.subscriptions[index];
|
||||
final color = _chartColors[index % _chartColors.length];
|
||||
final color =
|
||||
_chartColors[index % _chartColors.length];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 4.0),
|
||||
padding: const EdgeInsets.only(bottom: 4.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -385,31 +401,31 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
),
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
FutureBuilder<String>(
|
||||
future: CurrencyUtil
|
||||
.formatSubscriptionAmountWithLocale(
|
||||
subscription,
|
||||
context.read<LocaleProvider>().locale.languageCode),
|
||||
context
|
||||
.read<LocaleProvider>()
|
||||
.locale
|
||||
.languageCode),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return ThemedText(
|
||||
snapshot.data!,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child:
|
||||
CircularProgressIndicator(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
@@ -430,4 +446,4 @@ class _SubscriptionPieChartCardState extends State<SubscriptionPieChartCard> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ThemedText.headline(
|
||||
text: AppLocalizations.of(context).totalExpenseSummary,
|
||||
text:
|
||||
AppLocalizations.of(context).totalExpenseSummary,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
@@ -67,20 +68,24 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () async {
|
||||
final totalExpenseText = CurrencyUtil.formatTotalAmountWithLocale(totalExpense, locale);
|
||||
final totalExpenseText =
|
||||
CurrencyUtil.formatTotalAmountWithLocale(
|
||||
totalExpense, locale);
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: totalExpenseText));
|
||||
HapticFeedbackHelper.lightImpact();
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context).totalExpenseCopied(totalExpenseText)),
|
||||
content: Text(AppLocalizations.of(context)
|
||||
.totalExpenseCopied(totalExpenseText)),
|
||||
duration: const Duration(seconds: 2),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
backgroundColor: AppColors.glassBackground.withValues(alpha: 0.3),
|
||||
backgroundColor: AppColors.glassBackground
|
||||
.withValues(alpha: 0.3),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
@@ -115,7 +120,8 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ThemedText(
|
||||
CurrencyUtil.formatTotalAmountWithLocale(totalExpense, locale),
|
||||
CurrencyUtil.formatTotalAmountWithLocale(
|
||||
totalExpense, locale),
|
||||
style: const TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -134,10 +140,12 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.glassBackground.withValues(alpha: 0.3),
|
||||
color: AppColors.glassBackground
|
||||
.withValues(alpha: 0.3),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: AppColors.glassBorder.withValues(alpha: 0.2),
|
||||
color: AppColors.glassBorder
|
||||
.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
child: const FaIcon(
|
||||
@@ -152,7 +160,8 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemedText.caption(
|
||||
text: AppLocalizations.of(context).totalServices,
|
||||
text: AppLocalizations.of(context)
|
||||
.totalServices,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -160,7 +169,9 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).subscriptionCount(subscriptions.length),
|
||||
AppLocalizations.of(context)
|
||||
.subscriptionCount(
|
||||
subscriptions.length),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -176,10 +187,12 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.glassBackground.withValues(alpha: 0.3),
|
||||
color: AppColors.glassBackground
|
||||
.withValues(alpha: 0.3),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: AppColors.glassBorder.withValues(alpha: 0.2),
|
||||
color: AppColors.glassBorder
|
||||
.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
child: const FaIcon(
|
||||
@@ -194,7 +207,8 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
ThemedText.caption(
|
||||
text: AppLocalizations.of(context).averageCost,
|
||||
text: AppLocalizations.of(context)
|
||||
.averageCost,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -202,11 +216,13 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
ThemedText(
|
||||
CurrencyUtil.formatTotalAmountWithLocale(
|
||||
subscriptions.isEmpty
|
||||
? 0
|
||||
: totalExpense / subscriptions.length,
|
||||
locale),
|
||||
CurrencyUtil
|
||||
.formatTotalAmountWithLocale(
|
||||
subscriptions.isEmpty
|
||||
? 0
|
||||
: totalExpense /
|
||||
subscriptions.length,
|
||||
locale),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -230,4 +246,4 @@ class TotalExpenseSummaryCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user