TextEditingApp icon indicating copy to clipboard operation
TextEditingApp copied to clipboard

Linting Improvements: Use `withAlpha` Instead of `withOpacity`, Add `mounted` Checks for Context Safety

Open PearlGrell opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

There are some minor linting and best practice issues in the code that can be cleaned up for better consistency and long-term maintainability.


Describe the solution you'd like

  • Replace withOpacity(0.95) with withAlpha(242) for clarity and to align with linting recommendations (withOpacity is now deprecated).
  • Add a mounted check before using context in async callbacks (particularly in EditableTextWidget).
  • Ensure the code is compliant with Flutter's latest lint rules and avoids common pitfalls.

Approach to be followed (optional)

  • Follow existing structure — no need to refactor logic.
  • Use withAlpha when setting semi-transparent colors.
  • Wrap context usage after await with a mounted check.

Additional context

These are not functional bugs but polish-level improvements that enhance code quality, readability, and safety. Comment on the issue to get assigned.

PearlGrell avatar Jul 26 '25 16:07 PearlGrell

Thank you for opening this issue! 🚀 Our team will review it soon. Please make sure you've included all relevant details and followed our Contributing Guidelines. For questions about our project, check out our README and Code of Conduct.

github-actions[bot] avatar Jul 26 '25 16:07 github-actions[bot]

please assign me this issue @may-tas

PearlGrell avatar Jul 26 '25 16:07 PearlGrell

@PearlGrell I was gonna open this issue soon, thanks for opening it. Go ahead. Just for your reference if there is any color : Colors.primary.withOpacity(0.5); then you need to convert it to : Colors.primary.withAlpha((0.5*255).toInt());

may-tas avatar Jul 26 '25 16:07 may-tas