style: apply dart format across project
This commit is contained in:
@@ -46,12 +46,17 @@ class SubscriptionListWidget extends StatelessWidget {
|
||||
child: Consumer<CategoryProvider>(
|
||||
builder: (context, categoryProvider, child) {
|
||||
return CategoryHeaderWidget(
|
||||
categoryName: categoryProvider.getLocalizedCategoryName(context, category),
|
||||
categoryName: categoryProvider.getLocalizedCategoryName(
|
||||
context, category),
|
||||
subscriptionCount: subscriptions.length,
|
||||
totalCostUSD: _calculateTotalByCurrency(subscriptions, 'USD'),
|
||||
totalCostKRW: _calculateTotalByCurrency(subscriptions, 'KRW'),
|
||||
totalCostJPY: _calculateTotalByCurrency(subscriptions, 'JPY'),
|
||||
totalCostCNY: _calculateTotalByCurrency(subscriptions, 'CNY'),
|
||||
totalCostUSD:
|
||||
_calculateTotalByCurrency(subscriptions, 'USD'),
|
||||
totalCostKRW:
|
||||
_calculateTotalByCurrency(subscriptions, 'KRW'),
|
||||
totalCostJPY:
|
||||
_calculateTotalByCurrency(subscriptions, 'JPY'),
|
||||
totalCostCNY:
|
||||
_calculateTotalByCurrency(subscriptions, 'CNY'),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -95,41 +100,50 @@ class SubscriptionListWidget extends StatelessWidget {
|
||||
child: SwipeableSubscriptionCard(
|
||||
subscription: subscriptions[subIndex],
|
||||
onTap: () {
|
||||
print('[SubscriptionListWidget] SwipeableSubscriptionCard onTap 호출됨');
|
||||
AppNavigator.toDetail(context, subscriptions[subIndex]);
|
||||
print(
|
||||
'[SubscriptionListWidget] SwipeableSubscriptionCard onTap 호출됨');
|
||||
AppNavigator.toDetail(
|
||||
context, subscriptions[subIndex]);
|
||||
},
|
||||
onDelete: () async {
|
||||
// 현재 로케일에 맞는 서비스명 가져오기
|
||||
final localeProvider = Provider.of<LocaleProvider>(
|
||||
final localeProvider =
|
||||
Provider.of<LocaleProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final locale = localeProvider.locale.languageCode;
|
||||
final displayName = await SubscriptionUrlMatcher.getServiceDisplayName(
|
||||
serviceName: subscriptions[subIndex].serviceName,
|
||||
final locale =
|
||||
localeProvider.locale.languageCode;
|
||||
final displayName = await SubscriptionUrlMatcher
|
||||
.getServiceDisplayName(
|
||||
serviceName:
|
||||
subscriptions[subIndex].serviceName,
|
||||
locale: locale,
|
||||
);
|
||||
|
||||
|
||||
// 삭제 확인 다이얼로그 표시
|
||||
final shouldDelete = await DeleteConfirmationDialog.show(
|
||||
final shouldDelete =
|
||||
await DeleteConfirmationDialog.show(
|
||||
context: context,
|
||||
serviceName: displayName,
|
||||
);
|
||||
|
||||
|
||||
if (shouldDelete && context.mounted) {
|
||||
// 사용자가 확인한 경우에만 삭제 진행
|
||||
final provider = Provider.of<SubscriptionProvider>(
|
||||
context,
|
||||
final provider =
|
||||
Provider.of<SubscriptionProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
await provider.deleteSubscription(
|
||||
subscriptions[subIndex].id,
|
||||
);
|
||||
|
||||
|
||||
if (context.mounted) {
|
||||
AppSnackBar.showError(
|
||||
context: context,
|
||||
message: AppLocalizations.of(context).subscriptionDeleted(displayName),
|
||||
message: AppLocalizations.of(context)
|
||||
.subscriptionDeleted(displayName),
|
||||
icon: Icons.delete_forever_rounded,
|
||||
);
|
||||
}
|
||||
@@ -152,7 +166,8 @@ class SubscriptionListWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// 특정 통화의 총 합계를 계산합니다.
|
||||
double _calculateTotalByCurrency(List<SubscriptionModel> subscriptions, String currency) {
|
||||
double _calculateTotalByCurrency(
|
||||
List<SubscriptionModel> subscriptions, String currency) {
|
||||
return subscriptions
|
||||
.where((sub) => sub.currency == currency)
|
||||
.fold(0.0, (sum, sub) => sum + sub.monthlyCost);
|
||||
|
||||
Reference in New Issue
Block a user