Skip to content

Commit dea13f8

Browse files
authored
Added opacity note to withValues docstring (#162612)
issue: flutter/flutter#162069 This expands the docstring for `withValues()` to help people who are migrating from the old nomenclature. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 5a53ac3 commit dea13f8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

engine/src/flutter/lib/ui/painting.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ class Color {
288288
/// If [colorSpace] is provided, and is different than the current color
289289
/// space, the component values are updated before transforming them to the
290290
/// provided [ColorSpace].
291+
///
292+
/// Example:
293+
/// ```dart
294+
/// import 'dart:ui';
295+
/// /// Create a color with 50% opacity.
296+
/// Color makeTransparent(Color color) => color.withValues(alpha: 0.5);
297+
/// ```
291298
Color withValues({
292299
double? alpha,
293300
double? red,

0 commit comments

Comments
 (0)