Skip to content

fix: replace deprecated .withOpacity() with .withValues(alpha:) across codebase#922

Open
Varvyju wants to merge 1 commit intoCCExtractor:mainfrom
Varvyju:fix/replace-withOpacity-withValues
Open

fix: replace deprecated .withOpacity() with .withValues(alpha:) across codebase#922
Varvyju wants to merge 1 commit intoCCExtractor:mainfrom
Varvyju:fix/replace-withOpacity-withValues

Conversation

@Varvyju
Copy link
Copy Markdown

@Varvyju Varvyju commented Mar 31, 2026

Summary

Replaces all deprecated .withOpacity() calls with the modern
.withValues(alpha:) API across the entire codebase.

Changes

  • 128 replacements across 40 files
  • No logic changes — purely API modernisation
  • Forward compatible with Flutter's deprecation timeline

Testing Done

  • flutter analyze shows no new warnings introduced
  • Visual regression: UI appearance unchanged

Copilot AI review requested due to automatic review settings March 31, 2026 07:29
Copy link
Copy Markdown

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

Modernizes Flutter color usage by replacing deprecated Color.withOpacity() calls with Color.withValues(alpha:) across the app to stay aligned with Flutter’s deprecation timeline.

Changes:

  • Replaced withOpacity() with withValues(alpha:) across UI/theme code paths.
  • Minor whitespace/format-only cleanup in a few files (e.g., trailing brace spacing, enum indentation).

Reviewed changes

Copilot reviewed 32 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/app/utils/system_ringtone_service.dart Whitespace-only cleanup at file end.
lib/app/utils/GoogleHttpClient.dart Whitespace-only cleanup at file end.
lib/app/utils/end_drawer.dart Update drawer text/icon colors to withValues(alpha:).
lib/app/utils/constants.dart Update theme constants using alpha via withValues(alpha:).
lib/app/modules/timer/views/timer_view.dart Update timer view colors to withValues(alpha:).
lib/app/modules/timer/views/timer_animation.dart Update animated card background alpha handling.
lib/app/modules/stopwatch/views/stopwatch_view.dart Update menu icon color alpha handling.
lib/app/modules/settings/views/language_menu.dart Update dropdown icon alpha handling.
lib/app/modules/settings/views/google_sign_in.dart Update button/icon alpha handling.
lib/app/modules/settings/views/customize_undo_duration.dart Update trailing icon alpha handling + whitespace cleanup.
lib/app/modules/home/views/home_view.dart Update various home UI alpha colors to withValues(alpha:).
lib/app/modules/debug/views/debug_view.dart Update input/icon/helper text alpha colors + whitespace cleanup.
lib/app/modules/debug/controllers/debug_controller.dart Whitespace-only cleanup at file end.
lib/app/modules/debug/bindings/debug_binding.dart Whitespace-only cleanup at file end.
lib/app/modules/alarmChallenge/views/shake_challenge_view.dart Update alpha colors for text/icon.
lib/app/modules/alarmChallenge/views/qr_challenge_view.dart Update alpha colors for text/icon states.
lib/app/modules/alarmChallenge/views/pedometer_challenge_view.dart Update alpha colors for text/icon.
lib/app/modules/alarmChallenge/views/maths_challenge_view.dart Update button/icon alpha colors.
lib/app/modules/alarmChallenge/views/alarm_challenge_view.dart Update list tile icon/arrow alpha colors.
lib/app/modules/addOrUpdateAlarm/views/weather_tile.dart Update info icon and option UI alpha colors.
lib/app/modules/addOrUpdateAlarm/views/system_ringtone_picker.dart Update selected-state/background/border alpha colors + whitespace cleanup.
lib/app/modules/addOrUpdateAlarm/views/snooze_settings_tile.dart Whitespace-only cleanup at file end.
lib/app/modules/addOrUpdateAlarm/views/shared_users_tile.dart Update remove button text/icon alpha colors.
lib/app/modules/addOrUpdateAlarm/views/shared_alarm_tile.dart Update info/icon/button alpha colors.
lib/app/modules/addOrUpdateAlarm/views/shake_to_dismiss_tile.dart Update info icon alpha color.
lib/app/modules/addOrUpdateAlarm/views/ringtone_selection_page.dart Update empty-state/selection UI alpha colors + delete icon alpha + whitespace cleanup.
lib/app/modules/addOrUpdateAlarm/views/repeat_tile.dart Update checkbox border/active alpha colors.
lib/app/modules/addOrUpdateAlarm/views/qr_bar_code_tile.dart Update info icon alpha color.
lib/app/modules/addOrUpdateAlarm/views/pedometer_challenge_tile.dart Update info icon alpha color.
lib/app/modules/addOrUpdateAlarm/views/note.dart Update cursor/border alpha colors.
lib/app/modules/addOrUpdateAlarm/views/max_snooze_count_tile.dart Whitespace-only cleanup at file end.
lib/app/modules/addOrUpdateAlarm/views/maths_challenge_tile.dart Update info icon/labels/button alpha colors.
lib/app/modules/addOrUpdateAlarm/views/location_activity_tile.dart Update info icon alpha color.
lib/app/modules/addOrUpdateAlarm/views/label_tile.dart Update cursor/border alpha colors.
lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart Update info icon alpha color.
lib/app/modules/addOrUpdateAlarm/views/alarm_offset_tile.dart Update selected/unselected background alpha colors.
lib/app/modules/addOrUpdateAlarm/views/alarm_id_tile.dart Update trailing icon alpha colors.
lib/app/modules/addOrUpdateAlarm/controllers/add_or_update_alarm_controller.dart Update dialog button background alpha handling.
lib/app/data/models/system_ringtone_model.dart Whitespace-only cleanup at file end.
lib/app/data/models/debug_model.dart Format-only cleanup (enum indentation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 122 to 125
color: themeController.primaryTextColor.value
.withOpacity(
.withValues(alpha:
0.7,
),
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

The withValues call is split as withValues(alpha: on one line and the numeric value on the next, with extra whitespace. Please reformat (e.g., keep alpha: 0.7 together) to match the surrounding style and avoid noisy diffs.

Copilot uses AI. Check for mistakes.
Comment on lines 137 to 140
color: themeController.primaryTextColor.value
.withOpacity(
.withValues(alpha:
0.7,
),
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Same formatting issue here: withValues(alpha: is separated from its value onto the next line (and includes trailing whitespace). Please reformat so the named argument and value stay together for readability/consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +145 to 147
color: themeController.primaryTextColor.value.withValues(alpha:
0.9,
),
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

withValues(alpha: is separated from 0.9 onto the next line, which looks like an accidental wrap from the bulk replacement. Please reformat so the named argument and value are on the same line (or wrapped cleanly) to match the rest of the file.

Suggested change
color: themeController.primaryTextColor.value.withValues(alpha:
0.9,
),
color: themeController.primaryTextColor.value.withValues(alpha: 0.9),

Copilot uses AI. Check for mistakes.
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.

2 participants