updated Color docstring to address equality (flutter/engine#55496)

issue: https://github.com/flutter/flutter/issues/155803

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
gaaclarke
2024-09-27 14:41:08 -07:00
committed by GitHub
parent 1287ae153e
commit 9e2746c137

View File

@@ -78,10 +78,17 @@ Color _scaleAlpha(Color x, double factor) {
/// Color c2 = const Color(0xFFFFFFFF); // fully opaque white (visible)
/// ```
///
/// [Color]'s color components are stored as floating-point values. Care should
/// be taken if one does not want the literal equality provided by `operator==`.
/// To test equality inside of Flutter tests consider using `package:test`'s
/// `isSameColorAs`.
///
/// See also:
///
/// * [Colors](https://api.flutter.dev/flutter/material/Colors-class.html), which
/// defines the colors found in the Material Design specification.
/// * [Colors](https://api.flutter.dev/flutter/material/Colors-class.html),
/// which defines the colors found in the Material Design specification.
/// * [`isSameColorAs`](https://api.flutter.dev/flutter/flutter_test/isSameColorAs.html),
/// a Matcher to handle floating-point deltas when checking [Color] equality.
class Color {
/// Construct an sRGB color from the lower 32 bits of an [int].
///