Skip to content

Conversation

zensgit
Copy link
Owner

@zensgit zensgit commented Sep 27, 2025

Safe const adjustments in QR generator (remove const where parameters are non-const). Analyzer/test green.

@Copilot Copilot AI review requested due to automatic review settings September 27, 2025 08:06
Copy link

@Copilot Copilot AI left a 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 removes unnecessary const keywords from widget constructors where the constructor parameters are not compile-time constants. The change focuses on cleaning up const usage in the QR code generator widget to ensure proper const correctness.

  • Removed const keywords from Center and CircularProgressIndicator widgets that don't have const constructor parameters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 continues a series of const constructor cleanups, specifically focusing on the QR code generator widget. It addresses instances where const was incorrectly applied to widgets whose parameters were not compile-time constants, aligning the code with Flutter's const correctness guidelines and ensuring analyzer and test compliance.

Highlights

  • Const Keyword Cleanup: Removed const keywords from Center and CircularProgressIndicator widgets within the QR code generator. This correction ensures const correctness, as these widgets' parameters were not compile-time constants due to their context within a SizedBox using dynamic dimensions.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 removes const from widget constructors in qr_code_generator.dart. While the code remains valid, this change represents a minor performance pessimization. My review includes a suggestion to restore the const keyword, as this allows Flutter to optimize rendering by caching and reusing constant widgets, which is a recommended best practice.

Comment on lines 201 to 202
child: Center(
child: CircularProgressIndicator(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The const keyword was removed from Center and CircularProgressIndicator. Since both widgets are being constructed here without any non-constant parameters, they can and should be declared const. This allows Flutter to create a single, canonical instance of this widget subtree and reuse it, which improves performance.

Suggested change
child: Center(
child: CircularProgressIndicator(),
child: const Center(
child: const CircularProgressIndicator(),

@zensgit
Copy link
Owner Author

zensgit commented Sep 27, 2025

Addressed Gemini review: restored safe consts for Center/CircularProgressIndicator; kept non-const where runtime args (e.g., foregroundColor) are used to avoid invalid constants. Analyzer clean of hard errors; tests green.

@zensgit zensgit enabled auto-merge (squash) September 27, 2025 13:01
@zensgit zensgit merged commit 5d3e1ab into main Sep 27, 2025
9 checks passed
@zensgit zensgit deleted the flutter/const-cleanup-3 branch September 27, 2025 13:01
@zensgit zensgit mentioned this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant