You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our app, the function Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5) is used 48 times across 32 pages to apply opacity to colors. However, in Flutter version 3.27.2 and later, the withOpacity function has been deprecated. This requires updating our code to align with the latest Flutter version.
To resolve this issue, we can replace the deprecated function with: Theme.of(context).colorScheme.surfaceContainerHighest.withAlpha((0.5 * 255).round());
In Flutter's newer versions, withOpacity expects an integer-based opacity value. Since opacity values typically range from 0.0 to 1.0, multiplying by 255 converts it into an integer scale (0 to 255), which aligns with the updated API requirements.
Device Info (The device where you encountered this issue)
OS: MacOS
Version: Sequoia 15.0.1
The text was updated successfully, but these errors were encountered:
Describe the bug/problem
In our app, the function
Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5)
is used 48 times across 32 pages to apply opacity to colors. However, in Flutter version 3.27.2 and later, the withOpacity function has been deprecated. This requires updating our code to align with the latest Flutter version.Steps to Reproduce the bug/problem
Screenshot - https://drive.google.com/file/d/1Zxj_vd1-ufqfxvTMRn4GQ3970V8s4ZjW/view?usp=sharing
Solution
To resolve this issue, we can replace the deprecated function with:
Theme.of(context).colorScheme.surfaceContainerHighest.withAlpha((0.5 * 255).round());
In Flutter's newer versions, withOpacity expects an integer-based opacity value. Since opacity values typically range from 0.0 to 1.0, multiplying by 255 converts it into an integer scale (0 to 255), which aligns with the updated API requirements.
Device Info (The device where you encountered this issue)
The text was updated successfully, but these errors were encountered: