-
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
Conversation
…nce.share with ShareParams; add cross_file import
…nd leftover stub; fix const usage; migrate invite dialog share to SharePlus.instance
…/locals; capture messenger in batch dialogs; restore RightClickCopy with post-await safety; tidy comments
…action); batch_operation_bar context-safety ignores
…res; tidy image_utils comment
…ics to BalancePoint/dynamic/Transaction
… add intl import; doc _getCurrencySymbol; tidy source_badge
…rencySymbol; no behavior change
…ustomThemeEditor pre-captured messenger/navigator; QR uses eyeStyle/dataModuleStyle; AccountList uses AccountCard.fromAccount
Summary of ChangesHello @zensgit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a comprehensive cleanup and refactoring effort across several core Flutter components. The primary goals include enhancing code maintainability, resolving analyzer warnings, and modernizing API usage. Significant changes involve adopting ConsumerWidget for state management, implementing safer BuildContext access patterns in asynchronous contexts, updating QR code styling, and streamlining account card presentation and currency formatting. These changes collectively contribute to a more robust and efficient codebase. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Pull Request Overview
This PR performs analyzer cleanup for BudgetProgress, QR code generation, CustomThemeEditor, and AccountList components, focusing on removing unused variables, updating deprecated APIs, and improving context handling patterns.
- Converts BudgetProgress to ConsumerWidget with provider integration
- Updates QR code generation to use modern eyeStyle/dataModuleStyle instead of deprecated foregroundColor
- Implements pre-captured messenger/navigator pattern in multiple widgets to avoid context usage issues
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| source_badge.dart | Removes unused colorScheme variable |
| qr_code_generator.dart | Updates QR code styling to use eyeStyle and dataModuleStyle |
| custom_theme_editor.dart | Pre-captures ScaffoldMessenger and Navigator instances |
| right_click_copy.dart | Refactors to pre-capture messenger and improves variable naming |
| batch_operation_bar.dart | Pre-captures navigator/messenger and adds ignore comments |
| image_utils.dart | Removes unused image extension validation logic |
| transaction_list.dart | Removes unused currency_provider import |
| loading_widget.dart | Removes unused theme variable |
| dashboard_overview.dart | Updates type references and removes unused import |
| account_card.dart | Removes unused currency formatting and reorders imports |
| budget_progress.dart | Converts to ConsumerWidget and removes const modifier |
| account_list.dart | Uses AccountCard.fromAccount constructor |
| retry_interceptor.dart | Removes unused _lastGlobalFailure variable |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ]; | ||
|
|
||
| // 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) |
Copilot
AI
Sep 30, 2025
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.
Missing space between comments. Should be '// 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) |
Copilot uses AI. Check for mistakes.
| ), | ||
| ), | ||
| const SizedBox( | ||
| SizedBox( |
Copilot
AI
Sep 30, 2025
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.
| SizedBox( | |
| const SizedBox( |
Copilot uses AI. Check for mistakes.
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.
Code Review
This pull request introduces several cleanups and refactorings across different parts of the app. The changes to use Riverpod providers in BudgetProgress and centralize currency formatting are well done. The update to the QR code generator to use the new API is also a good improvement.
I've left a few comments on areas that could be improved:
- A potential loss of type safety in
DashboardData. - Incorrect handling of
use_build_context_synchronouslylint inCustomThemeEditor. - Redundant
ignorecomments and unnecessaryasyncinBatchOperationBar. - A 'fire-and-forget' async call in
RightClickCopy.
Please take a look at the specific comments for more details. Overall, a good set of changes.
| final navigator = Navigator.of(context); | ||
| navigator.pop(finalTheme); |
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.
navigator is initialized here, after an await call inside the try block (lines 748 or 750). This does not fix the use_build_context_synchronously lint warning. To fix it correctly, you should capture Navigator.of(context) before the try block that contains the await call. A similar issue exists for messenger in the catch block on line 763.
| 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 comment
The reason will be displayed to describe this comment to others. Learn more.
The type of quickActions has been changed to List<dynamic>, which weakens type safety and can lead to runtime errors. It's recommended to use a specific type like List<QuickActionData>. If you need to support different action types, consider defining a common abstract base class for them and using a list of that base type.
| // ignore: use_build_context_synchronously | ||
| navigator.pop(); | ||
| widget.onCancel(); | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| // ignore: use_build_context_synchronously | ||
| messenger.showSnackBar( |
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.
| onLongPress: () { | ||
| // 移动端长按直接复制 | ||
| _copy(context); | ||
| _copyWithMessenger(messenger); | ||
| }, |
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 onLongPress callback calls _copyWithMessenger, which is an async function, without await. This creates a "fire-and-forget" future. While this might be intentional, it's generally better to await futures to handle potential errors and ensure execution order. Consider making the callback async and awaiting the call.
| onLongPress: () { | |
| // 移动端长按直接复制 | |
| _copy(context); | |
| _copyWithMessenger(messenger); | |
| }, | |
| onLongPress: () async { | |
| // 移动端长按直接复制 | |
| await _copyWithMessenger(messenger); | |
| }, |
Validation: tests green; analyzer OK for changed areas