fix: replace deprecated .withOpacity() with .withValues(alpha:) across codebase#922
fix: replace deprecated .withOpacity() with .withValues(alpha:) across codebase#922Varvyju wants to merge 1 commit intoCCExtractor:mainfrom
Conversation
There was a problem hiding this comment.
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()withwithValues(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.
| color: themeController.primaryTextColor.value | ||
| .withOpacity( | ||
| .withValues(alpha: | ||
| 0.7, | ||
| ), |
There was a problem hiding this comment.
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.
| color: themeController.primaryTextColor.value | ||
| .withOpacity( | ||
| .withValues(alpha: | ||
| 0.7, | ||
| ), |
There was a problem hiding this comment.
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.
| color: themeController.primaryTextColor.value.withValues(alpha: | ||
| 0.9, | ||
| ), |
There was a problem hiding this comment.
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.
| color: themeController.primaryTextColor.value.withValues(alpha: | |
| 0.9, | |
| ), | |
| color: themeController.primaryTextColor.value.withValues(alpha: 0.9), |
Summary
Replaces all deprecated
.withOpacity()calls with the modern.withValues(alpha:)API across the entire codebase.Changes
Testing Done
flutter analyzeshows no new warnings introduced