-
Notifications
You must be signed in to change notification settings - Fork 0
flutter: FamilySettings — fix analyzer (unawaited + toJson) #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e32a396
b73c86d
ecf4aaf
fe15ab2
ab07b45
5e8fb37
ccea7a8
0ff1898
84b7618
74f71a5
07996fd
7e69656
b9ad4db
151727c
6f6cf73
2e4a6fb
4a8a602
cf31e80
75d6909
bb6649f
e287acb
bd79d99
a5f32aa
717cfb0
de35fa2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart'; | |||||
| import 'package:shared_preferences/shared_preferences.dart'; | ||||||
| import 'dart:convert'; | ||||||
| import 'package:jive_money/services/api/family_service.dart'; | ||||||
| import 'dart:async'; | ||||||
|
|
||||||
| /// 家庭设置服务 - 负责设置的持久化和同步 | ||||||
| class FamilySettingsService extends ChangeNotifier { | ||||||
|
|
@@ -66,7 +67,7 @@ class FamilySettingsService extends ChangeNotifier { | |||||
| )); | ||||||
|
|
||||||
| // 尝试同步 | ||||||
| _syncToServer(); | ||||||
| unawaited(_syncToServer()); | ||||||
|
|
||||||
| notifyListeners(); | ||||||
| } | ||||||
|
|
@@ -115,7 +116,7 @@ class FamilySettingsService extends ChangeNotifier { | |||||
| timestamp: DateTime.now(), | ||||||
| )); | ||||||
|
|
||||||
| _syncToServer(); | ||||||
| unawaited(_syncToServer()); | ||||||
| notifyListeners(); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -137,7 +138,7 @@ class FamilySettingsService extends ChangeNotifier { | |||||
| timestamp: DateTime.now(), | ||||||
| )); | ||||||
|
|
||||||
| _syncToServer(); | ||||||
| unawaited(_syncToServer()); | ||||||
| notifyListeners(); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -179,7 +180,7 @@ class FamilySettingsService extends ChangeNotifier { | |||||
| if (change.type == ChangeType.update) { | ||||||
| success = await _familyService.updateFamilySettings( | ||||||
| change.entityId, | ||||||
| FamilySettings.fromJson(change.data!), | ||||||
| FamilySettings.fromJson(change.data!).toJson(), | ||||||
| ); | ||||||
| } else if (change.type == ChangeType.delete) { | ||||||
| success = | ||||||
|
|
@@ -225,7 +226,7 @@ class FamilySettingsService extends ChangeNotifier { | |||||
|
|
||||||
| /// 强制同步 | ||||||
| Future<void> forceSync() async { | ||||||
| await _syncToServer(); | ||||||
| unawaited(_syncToServer()); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| /// 从服务器拉取最新设置 | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,11 +1,10 @@ | ||||||
| // 仪表板概览组件 | ||||||
| import 'package:flutter/material.dart'; | ||||||
| import 'package:jive_money/core/constants/app_constants.dart'; | ||||||
| import 'package:jive_money/ui/components/charts/balance_chart.dart'; | ||||||
| import 'package:jive_money/ui/components/dashboard/summary_card.dart'; | ||||||
| import 'package:jive_money/ui/components/dashboard/quick_actions.dart'; | ||||||
| import 'package:jive_money/ui/components/dashboard/recent_transactions.dart'; | ||||||
| import 'package:jive_money/ui/components/cards/transaction_card.dart'; | ||||||
| import 'package:jive_money/models/transaction.dart'; | ||||||
|
|
||||||
| class DashboardOverview extends StatelessWidget { | ||||||
| final DashboardData data; | ||||||
|
|
@@ -309,9 +308,9 @@ class DashboardOverview extends StatelessWidget { | |||||
| /// 仪表板数据模型 | ||||||
| class DashboardData { | ||||||
| final List<SummaryCardData> summaryCards; | ||||||
| final List<BalanceDataPoint> balanceData; | ||||||
| final List<QuickActionData> quickActions; | ||||||
| final List<TransactionData> recentTransactions; | ||||||
| final List<BalancePoint> balanceData; | ||||||
| final List<dynamic> quickActions; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type of
Suggested change
|
||||||
| final List<Transaction> recentTransactions; | ||||||
| final List<AccountOverviewData> accounts; | ||||||
| final List<BudgetOverviewData> budgets; | ||||||
| final VoidCallback? onViewAllTransactions; | ||||||
|
|
@@ -363,4 +362,4 @@ class BudgetOverviewData { | |||||
| required this.spent, | ||||||
| required this.progress, | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -147,18 +147,7 @@ class ImageUtils { | |||||||
| return false; | ||||||||
| } | ||||||||
|
|
||||||||
| // Check for common image extensions | ||||||||
| final path = uri.path.toLowerCase(); | ||||||||
| final imageExtensions = [ | ||||||||
| '.jpg', | ||||||||
| '.jpeg', | ||||||||
| '.png', | ||||||||
| '.gif', | ||||||||
| '.webp', | ||||||||
| '.svg' | ||||||||
| ]; | ||||||||
|
|
||||||||
| // Allow URLs without extensions (many CDNs don't use them) | ||||||||
| // Check for common image extensions// Allow URLs without extensions (many CDNs don't use them) | ||||||||
|
||||||||
| // Check for common image extensions// Allow URLs without extensions (many CDNs don't use them) | |
| // Check for common image extensions | |
| // Allow URLs without extensions (many CDNs don't use them) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The forceSync() method should await the sync operation rather than making it unawaited, as users calling forceSync() likely expect synchronous completion.