-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added .keys to ColorSwatch #155262
Added .keys to ColorSwatch #155262
Conversation
@@ -422,6 +422,9 @@ class ColorSwatch<T> extends Color { | |||
/// Returns an element of the swatch table. | |||
Color? operator [](T index) => _swatch[index]; | |||
|
|||
/// Returns the valid keys for accessing operator[]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe rename this to indices
? Since that's the terminology used by existing documentation (https://main-api.flutter.dev/flutter/painting/ColorSwatch-class.html), e.g.:
The table is indexed by values of type T.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather change the documentation since index
suggests the keys are integers. That already tripped me up. What do you think about "The table is accessed with key values of type T."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok yeah calling the getter indices
could be a bit misleading (although the word by itself doesn't seem to imply the key being an integer: https://en.wiktionary.org/wiki/index#Noun).
An integer or other key indicating the location of data
(the change still LGTM)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, seems that doesn't imply a number to everyone. However if that was the preferred nomenclature that's what we'd use in Map which has the same semantics in its operator[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit that updates the other documentation, PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those updates LGTM except there's one more reference to "index" in the doc on the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after @/LongCatIsLooong 's suggestions.
auto label is removed for flutter/flutter/155262, due to - The status or check suite Windows build_tests_2_7 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
flutter/flutter@5d83a98...c4c9f47 2024-09-17 engine-flutter-autoroll@skia.org Roll Flutter Engine from a328f2362414 to 1376288f5c2a (1 revision) (flutter/flutter#155282) 2024-09-17 engine-flutter-autoroll@skia.org Roll Flutter Engine from 04bc90bff86c to a328f2362414 (2 revisions) (flutter/flutter#155280) 2024-09-16 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6b698138c600 to 04bc90bff86c (3 revisions) (flutter/flutter#155277) 2024-09-16 30870216+gaaclarke@users.noreply.github.com Added .keys to ColorSwatch (flutter/flutter#155262) 2024-09-16 engine-flutter-autoroll@skia.org Roll Flutter Engine from 362b9bcdedce to 6b698138c600 (4 revisions) (flutter/flutter#155267) 2024-09-16 engine-flutter-autoroll@skia.org Roll Packages from 330581f to df88c81 (7 revisions) (flutter/flutter#155261) 2024-09-16 sstrickl@google.com Extend 'flutter symbolize' to handle deferred loading units. (flutter/flutter#149315) 2024-09-16 christopherfujino@gmail.com Catch unable to start app exception (flutter/flutter#154970) 2024-09-16 magder@google.com Assert iOS framework artifact contains xcprivacy manifest (flutter/flutter#155187) 2024-09-16 engine-flutter-autoroll@skia.org Roll Flutter Engine from 52dcc8a16d8b to 362b9bcdedce (1 revision) (flutter/flutter#155241) 2024-09-16 engine-flutter-autoroll@skia.org Roll Flutter Engine from af4fe97fa13a to 52dcc8a16d8b (1 revision) (flutter/flutter#155238) 2024-09-16 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9aaea5a4bd50 to af4fe97fa13a (1 revision) (flutter/flutter#155235) 2024-09-16 engine-flutter-autoroll@skia.org Roll Flutter Engine from fe22a199aca3 to 9aaea5a4bd50 (1 revision) (flutter/flutter#155232) 2024-09-15 engine-flutter-autoroll@skia.org Roll Flutter Engine from f5ccef12c15c to fe22a199aca3 (1 revision) (flutter/flutter#155229) 2024-09-15 engine-flutter-autoroll@skia.org Roll Flutter Engine from 622d4aec2e04 to f5ccef12c15c (1 revision) (flutter/flutter#155215) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC rmistry@google.com,stuartmorgan@google.com,tarrinneal@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This addresses the issue that ColorSwatch has operator[], but no way to know what are valid inputs.
issue: #155113
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.