-
Notifications
You must be signed in to change notification settings - Fork 0
flutter: analyzer cleanup batch 10-C — BudgetProgress/QR/ThemeEditor/AccountList #82
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
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 |
|---|---|---|
| @@ -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 |
||
| 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) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,10 +227,14 @@ class _BatchOperationBarState extends ConsumerState<BatchOperationBar> | |
| ), | ||
| ElevatedButton( | ||
| onPressed: () async { | ||
| final navigator = Navigator.of(context); | ||
| final messenger = ScaffoldMessenger.of(context); | ||
| // TODO: 实现批量归档 | ||
| Navigator.pop(context); | ||
| // ignore: use_build_context_synchronously | ||
| navigator.pop(); | ||
| widget.onCancel(); | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| // ignore: use_build_context_synchronously | ||
| messenger.showSnackBar( | ||
| SnackBar( | ||
| content: Text('已归档 ${widget.selectedIds.length} 个项目'), | ||
| ), | ||
|
|
@@ -299,11 +303,15 @@ class _BatchOperationBarState extends ConsumerState<BatchOperationBar> | |
| ), | ||
| onPressed: () async { | ||
| final provider = ref.read(categoryManagementProvider); | ||
| final navigator = Navigator.of(context); | ||
| final messenger = ScaffoldMessenger.of(context); | ||
| await provider.batchDeleteCategories(widget.selectedIds); | ||
| if (!context.mounted) return; | ||
| Navigator.pop(context); | ||
| if (!mounted) return; | ||
| // ignore: use_build_context_synchronously | ||
| navigator.pop(); | ||
| widget.onCancel(); | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| // ignore: use_build_context_synchronously | ||
| messenger.showSnackBar( | ||
|
Comment on lines
+310
to
+314
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. |
||
| SnackBar( | ||
| content: Text('已删除 ${widget.selectedIds.length} 个项目'), | ||
| action: SnackBarAction( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,11 +25,8 @@ class RightClickCopy extends StatelessWidget { | |||||||||||||||||||
| this.padding, | ||||||||||||||||||||
| }); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| void _copy(BuildContext context) async { | ||||||||||||||||||||
| Future<void> _copyWithMessenger(ScaffoldMessengerState? messenger) async { | ||||||||||||||||||||
| await Clipboard.setData(ClipboardData(text: copyText)); | ||||||||||||||||||||
| if (!context.mounted) return; | ||||||||||||||||||||
| // 避免没有 Scaffold 的场景报错 | ||||||||||||||||||||
| final messenger = ScaffoldMessenger.maybeOf(context); | ||||||||||||||||||||
| messenger?.hideCurrentSnackBar(); | ||||||||||||||||||||
| messenger?.showSnackBar( | ||||||||||||||||||||
| SnackBar( | ||||||||||||||||||||
|
|
@@ -41,12 +38,14 @@ class RightClickCopy extends StatelessWidget { | |||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Future<void> _showContextMenu(BuildContext context, Offset position) async { | ||||||||||||||||||||
| final overlay = Overlay.of(context).context.findRenderObject() as RenderBox; | ||||||||||||||||||||
| final overlayBox = Overlay.of(context).context.findRenderObject() as RenderBox; | ||||||||||||||||||||
| final messenger = ScaffoldMessenger.maybeOf(context); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| final result = await showMenu<String>( | ||||||||||||||||||||
| context: context, | ||||||||||||||||||||
| position: RelativeRect.fromRect( | ||||||||||||||||||||
| Rect.fromLTWH(position.dx, position.dy, 0, 0), | ||||||||||||||||||||
| Offset.zero & overlay.size, | ||||||||||||||||||||
| Offset.zero & overlayBox.size, | ||||||||||||||||||||
| ), | ||||||||||||||||||||
| items: const [ | ||||||||||||||||||||
| PopupMenuItem<String>( | ||||||||||||||||||||
|
|
@@ -62,13 +61,16 @@ class RightClickCopy extends StatelessWidget { | |||||||||||||||||||
| ), | ||||||||||||||||||||
| ], | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (result == 'copy') { | ||||||||||||||||||||
| _copy(context); | ||||||||||||||||||||
| await _copyWithMessenger(messenger); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| @override | ||||||||||||||||||||
| Widget build(BuildContext context) { | ||||||||||||||||||||
| final messenger = ScaffoldMessenger.maybeOf(context); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Widget content = child; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (showIconOnHover) { | ||||||||||||||||||||
|
|
@@ -86,7 +88,7 @@ class RightClickCopy extends StatelessWidget { | |||||||||||||||||||
| }, | ||||||||||||||||||||
| onLongPress: () { | ||||||||||||||||||||
| // 移动端长按直接复制 | ||||||||||||||||||||
| _copy(context); | ||||||||||||||||||||
| _copyWithMessenger(messenger); | ||||||||||||||||||||
| }, | ||||||||||||||||||||
|
Comment on lines
89
to
92
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
Suggested change
|
||||||||||||||||||||
| child: content, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -613,7 +613,8 @@ class _CustomThemeEditorState extends State<CustomThemeEditor> | |
| ); | ||
| }); | ||
|
|
||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| final messenger = ScaffoldMessenger.of(context); | ||
| messenger.showSnackBar( | ||
| SnackBar( | ||
| content: Text('已应用"${preset.name}"模板'), | ||
| backgroundColor: Colors.green, | ||
|
|
@@ -722,7 +723,8 @@ class _CustomThemeEditorState extends State<CustomThemeEditor> | |
|
|
||
| Future<void> _saveTheme() async { | ||
| if (_nameController.text.trim().isEmpty) { | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| final messenger = ScaffoldMessenger.of(context); | ||
| messenger.showSnackBar( | ||
| const SnackBar( | ||
| content: Text('请输入主题名称'), | ||
| backgroundColor: Colors.red, | ||
|
|
@@ -755,9 +757,11 @@ class _CustomThemeEditorState extends State<CustomThemeEditor> | |
|
|
||
| if (!context.mounted) return; | ||
|
|
||
| Navigator.of(context).pop(finalTheme); | ||
| final navigator = Navigator.of(context); | ||
| navigator.pop(finalTheme); | ||
|
Comment on lines
+760
to
+761
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.
|
||
| } catch (e) { | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| final messenger = ScaffoldMessenger.of(context); | ||
| messenger.showSnackBar( | ||
| SnackBar( | ||
| content: Text('保存失败: $e'), | ||
| backgroundColor: Colors.red, | ||
|
|
||
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 const modifier was removed from SizedBox, but since width is a compile-time constant (45), this should remain const for better performance.