Skip to content

Conversation

@zensgit
Copy link
Owner

@zensgit zensgit commented Sep 27, 2025

flutter: const constructors cleanup (batch 1)

Scope

  • Safe, no-behavior-change const optimizations where analyzer flagged prefer_const_constructors.
  • Focused on widgets: invite_member_dialog.dart initial pass.

Changes

  • invite_member_dialog.dart: make TextStyle const in _buildInfoRow where values are compile-time constants.

Why

  • Reduces rebuild cost and analyzer noise without changing runtime behavior.

Validation

  • Ran flutter analyze — no blocking errors.
  • Ran flutter test — all tests passing (10/10).

Next

  • Batch 2: broaden const constructors within widgets and ui/components where clearly safe.
  • Separate PRs for deprecated API migrations (e.g., Share→SharePlus) and context-safety warnings.

@zensgit zensgit marked this pull request as ready for review September 27, 2025 05:58
@Copilot Copilot AI review requested due to automatic review settings September 27, 2025 05:58
Copy link

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 pull request performs const constructor optimizations and API migration updates across Flutter and Rust codebases. The primary focus is reducing rebuild costs through const constructors while also migrating from deprecated Flutter APIs.

  • Make compile-time constant constructors const to optimize widget rebuilds
  • Replace deprecated withOpacity() calls with withValues(alpha:) API
  • Update method signatures to include BuildContext parameters for proper context usage
  • Add integration tests for auth registration routes with family/ledger creation validation

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test_tag_functionality.dart Replace deprecated withOpacity with withValues API
tag_demo.dart Replace deprecated withOpacity with withValues API
qr_code_generator.dart Mixed const constructor changes and property removals
permission_guard.dart Add const constructors and improve null safety patterns
invite_member_dialog.dart Add const constructors for compile-time constant widgets
dashboard_overview.dart Add BuildContext parameters to private methods
account_adapter.dart Simplify null-conditional operator usage
mod.rs Add new integration test module
auth_register_route_e2e_test.rs New integration test for auth registration flow
auth_register_enhanced_route_e2e_test.rs New integration test for enhanced registration
family_service.rs Add owner_id field to family creation and improve logging
main.rs Update route handler reference
enhanced_profile.rs Add comprehensive logging and error handling
auth.rs Refactor user/family creation order with owner_id support

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

child: Center(
child: CircularProgressIndicator(),
child: const Center(
child: const CircularProgressIndicator(),
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

Remove the redundant const keyword. The parent const Center already makes the child widget const.

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

Copilot uses AI. Check for mistakes.

Comment on lines +198 to +202
? SizedBox(
width: widget.size,
height: widget.size,
child: Center(
child: CircularProgressIndicator(),
child: const Center(
child: const CircularProgressIndicator(),
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The SizedBox should be const since all its properties (width, height, child) use compile-time constants. Change SizedBox( to const SizedBox(.

Copilot uses AI. Check for mistakes.

Comment on lines +421 to 424
SizedBox(
width: 60,
child: Text(
'$label:',
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The SizedBox should be const since its width is a compile-time constant and the Text widget uses string interpolation that could be evaluated at compile time for static labels. Consider making this const SizedBox( if the label parameter is always a compile-time constant.

Copilot uses AI. Check for mistakes.

),
const SizedBox(height: 20),
const SizedBox(
SizedBox(
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The SizedBox should be const since its height is a compile-time constant. Change SizedBox( to const SizedBox( to be consistent with the const optimization goals of this PR.

Suggested change
SizedBox(
const SizedBox(

Copilot uses AI. Check for mistakes.

@zensgit zensgit merged commit d2c27fe into main Sep 27, 2025
18 checks passed
@zensgit zensgit deleted the flutter/const-cleanup-1 branch September 27, 2025 06:06
@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