Skip to content

Support brightness override in a11y page #9898

Open
hannah-hyj wants to merge 3 commits into
flutter:masterfrom
hannah-hyj:a11y_brightness
Open

Support brightness override in a11y page #9898
hannah-hyj wants to merge 3 commits into
flutter:masterfrom
hannah-hyj:a11y_brightness

Conversation

@hannah-hyj

@hannah-hyj hannah-hyj commented Jul 16, 2026

Copy link
Copy Markdown
Member

tracking issue: #9893

Screen.Recording.2026-07-16.at.13.41.32.mov

the ext.flutter.brightnessOverride service extension and VM service support to Flutter was added a while ago in PR #59571

Pre-launch Checklist

General checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

build.yaml badge

If you need help, consider asking for help on Discord.

@hannah-hyj
hannah-hyj requested a review from elliette July 16, 2026 20:41
@hannah-hyj
hannah-hyj requested review from a team and kenzieschmoll as code owners July 16, 2026 20:41
@hannah-hyj
hannah-hyj requested review from bkonyi and removed request for a team July 16, 2026 20:41

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the VM service extension integration for overriding brightness in the accessibility controls. It defines the brightnessMode service extension, updates the AccessibilityController to listen to device-side brightness changes, and sends updates back to the VM service when changed via the DevTools UI. Additionally, it adds corresponding analytics constants and comprehensive tests. The reviewer raised a concern regarding potential feedback loops and redundant VM service calls when brightness changes originate from the device itself, suggesting a boolean guard to prevent unnecessary updates.

1
Update overrides_pane.dart

Update accessibility_controller.dart

tests

Update service_extensions.dart

@kenzieschmoll kenzieschmoll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this PR is missing the UI code to add the dropdown. Can you include that in this PR?

Comment thread packages/devtools_app/lib/src/screens/accessibility/accessibility_controller.dart Outdated
Comment on lines +60 to +62
if (brightness.value != newBrightness) {
brightness.value = newBrightness;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just call brightness.value = newBrightness directly. The value notifier will return early and not notify if the values are the same.

Suggested change
if (brightness.value != newBrightness) {
brightness.value = newBrightness;
}
brightness.value = newBrightness;

/// Service extension description for overriding brightness in accessibility controls.
final brightnessMode = ServiceExtensionDescription<String>.from(
extensions.brightnessMode,
title: 'Override brightness',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: capital 'B' to match other service extension titles

Suggested change
title: 'Override brightness',
title: 'Override Brightness',

await pumpAccessibilityScreen(tester);
await tester.pumpAndSettle();

expect(controller.brightness.value, BrightnessOverride.system);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isn't actually testing the accessibility screen UI so it doesn't need to be a widget test. Can you make a new test file accessibility_controller_test.dart that has unit tests to verify this behavior instead?

Comment on lines +79 to +83
final paramValue = switch (value) {
BrightnessOverride.light => 'Brightness.light',
BrightnessOverride.dark => 'Brightness.dark',
BrightnessOverride.system => '',
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider final paramValue = value.name instead. This will evaluate to "light", "dark", or "system". I think using "system" instead of empty string will be make for a more understandable API.

@hannah-hyj

Copy link
Copy Markdown
Member Author

@kenzieschmoll The UI code was merged in #9892, so this PR is just to add functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants