DEV Community

ahmed tharwat
ahmed tharwat

Posted on

Answer: Why is withOpacity deprecated in Flutter 3.27.0, and what is its recommended replacement?

hi , i faced this problem and solved it by this way :

Replace this incorrect block:

Theme.of(context).textTheme.bodyMedium?.copyWith(
  color: Theme.of(context)
      .textTheme
      .bodyMedium
      ?.color
      ?.withValues(alpha: 0.7),
),

With this correct version:

Theme.of(context).textTheme.bodyMedium?.copyWith(
  color: Theme.of(context)
      .textTheme
      .bodyMedium
      ?.color
      ?.withOpacity(0.7),
),

Top comments (0)