Skip to content

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Sep 16, 2024

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.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Sep 16, 2024
/// Returns an element of the swatch table.
Color? operator [](T index) => _swatch[index];

/// Returns the valid keys for accessing operator[].
Copy link
Contributor

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.

Copy link
Member Author

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."?

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong Sep 16, 2024

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)

Copy link
Member Author

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[].

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Contributor

@dkwingsmt dkwingsmt left a 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.

@gnprice gnprice mentioned this pull request Sep 16, 2024
8 tasks
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 16, 2024
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 16, 2024

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.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 16, 2024
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 16, 2024
@auto-submit auto-submit bot merged commit af21d9f into flutter:master Sep 16, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 16, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 17, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Sep 17, 2024
flutter/flutter@5d83a98...c4c9f47

2024-09-17 [email protected] Roll Flutter Engine from a328f2362414 to 1376288f5c2a (1 revision) (flutter/flutter#155282)
2024-09-17 [email protected] Roll Flutter Engine from 04bc90bff86c to a328f2362414 (2 revisions) (flutter/flutter#155280)
2024-09-16 [email protected] Roll Flutter Engine from 6b698138c600 to 04bc90bff86c (3 revisions) (flutter/flutter#155277)
2024-09-16 [email protected] Added .keys to ColorSwatch (flutter/flutter#155262)
2024-09-16 [email protected] Roll Flutter Engine from 362b9bcdedce to 6b698138c600 (4 revisions) (flutter/flutter#155267)
2024-09-16 [email protected] Roll Packages from 330581f to df88c81 (7 revisions) (flutter/flutter#155261)
2024-09-16 [email protected] Extend 'flutter symbolize' to handle deferred loading units. (flutter/flutter#149315)
2024-09-16 [email protected] Catch unable to start app exception (flutter/flutter#154970)
2024-09-16 [email protected] Assert iOS framework artifact contains xcprivacy manifest (flutter/flutter#155187)
2024-09-16 [email protected] Roll Flutter Engine from 52dcc8a16d8b to 362b9bcdedce (1 revision) (flutter/flutter#155241)
2024-09-16 [email protected] Roll Flutter Engine from af4fe97fa13a to 52dcc8a16d8b (1 revision) (flutter/flutter#155238)
2024-09-16 [email protected] Roll Flutter Engine from 9aaea5a4bd50 to af4fe97fa13a (1 revision) (flutter/flutter#155235)
2024-09-16 [email protected] Roll Flutter Engine from fe22a199aca3 to 9aaea5a4bd50 (1 revision) (flutter/flutter#155232)
2024-09-15 [email protected] Roll Flutter Engine from f5ccef12c15c to fe22a199aca3 (1 revision) (flutter/flutter#155229)
2024-09-15 [email protected] 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 [email protected],[email protected],[email protected] 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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants