Skip to content

fix AppBar's docs for backgroundColor #126194

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

Merged
merged 1 commit into from
May 9, 2023

Conversation

werainkhatri
Copy link
Member

@werainkhatri werainkhatri commented May 6, 2023

the documentation in question:

/// The default app bar [backgroundColor] is the overall theme's
/// [ColorScheme.primary] if the overall theme's brightness is
/// [Brightness.light]. Unfortunately this is the same as the default
/// [ButtonStyle.foregroundColor] for [TextButton] for light themes.
/// In this case a preferable text button foreground color is
/// [ColorScheme.onPrimary], a color that contrasts nicely with
/// [ColorScheme.primary]. To remedy the problem, override
/// [TextButton.style]:

series of events:

  1. [07/2021] an issue was identified in AppBar and TextButton and a troubleshooting section was added to the docs (PR) explaining the situation and providing a remedy.
  2. [07/2022] AppBar was migrated to M3 (PR).

before the M3 migration, the doc made sense. but after, it needed to specify which material version does this issue occur in.
also, M3 default of ButtonStyle.foregroundColor for TextButton is still ColorScheme.primary (except for the disabled state, where its ColorScheme.onSurface) and default for AppBar.backgroundColor is now ColorScheme.surface, the issue explained in the doc does not occur in M3.

MaterialStateProperty<Color?>? get foregroundColor =>
MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return _colors.onSurface.withOpacity(0.38);
}
return _colors.primary;
});

Fixes #126168

Pre-launch 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 and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@werainkhatri werainkhatri requested a review from HansMuller May 6, 2023 06:36
@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 6, 2023
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

@HansMuller HansMuller merged commit 5b87e4f into flutter:master May 9, 2023
@werainkhatri werainkhatri deleted the fix-appbar-bgcolor-docs branch May 9, 2023 18:41
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
camsim99 pushed a commit to flutter/packages that referenced this pull request May 12, 2023
flutter/flutter@8c5a1ea...a76dbe4

2023-05-10 [email protected] Manual roll Flutter Engine
from 8ca16cba8c38 to 78f41a8f2f06 (2 revisions) (flutter/flutter#126392)
2023-05-10 [email protected] Roll flutter/packages to 0167d83
(flutter/flutter#126427)
2023-05-10 [email protected] Migrate gallery
ios tests to build+test (flutter/flutter#111164)
2023-05-09 [email protected] Roll Flutter Engine from
824cd09b8c62 to 8ca16cba8c38 (5 revisions) (flutter/flutter#126360)
2023-05-09 [email protected] Revert "Provide default constraints
for M3 dialogs" (flutter/flutter#126355)
2023-05-09 [email protected] Roll Packages from
4800d65 to 1f91710 (8 revisions) (flutter/flutter#126352)
2023-05-09 [email protected] [github] Add labeler action
(flutter/flutter#126012)
2023-05-09 [email protected] Fix platformLocation path and search
dropping (flutter/flutter#126232)
2023-05-09 [email protected] Roll Flutter Engine from
8d3a8162b3ab to 824cd09b8c62 (10 revisions) (flutter/flutter#126309)
2023-05-09 [email protected] Update FocusNode documentation
(flutter/flutter#126331)
2023-05-09 [email protected] Remove dead code
(flutter/flutter#126266)
2023-05-09 [email protected] fix AppBar's
docs for backgroundColor (flutter/flutter#126194)

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
flutter/flutter@8c5a1ea...a76dbe4

2023-05-10 [email protected] Manual roll Flutter Engine
from 8ca16cba8c38 to 78f41a8f2f06 (2 revisions) (flutter/flutter#126392)
2023-05-10 [email protected] Roll flutter/packages to 0167d83
(flutter/flutter#126427)
2023-05-10 [email protected] Migrate gallery
ios tests to build+test (flutter/flutter#111164)
2023-05-09 [email protected] Roll Flutter Engine from
824cd09b8c62 to 8ca16cba8c38 (5 revisions) (flutter/flutter#126360)
2023-05-09 [email protected] Revert "Provide default constraints
for M3 dialogs" (flutter/flutter#126355)
2023-05-09 [email protected] Roll Packages from
4800d65 to 1f91710 (8 revisions) (flutter/flutter#126352)
2023-05-09 [email protected] [github] Add labeler action
(flutter/flutter#126012)
2023-05-09 [email protected] Fix platformLocation path and search
dropping (flutter/flutter#126232)
2023-05-09 [email protected] Roll Flutter Engine from
8d3a8162b3ab to 824cd09b8c62 (10 revisions) (flutter/flutter#126309)
2023-05-09 [email protected] Update FocusNode documentation
(flutter/flutter#126331)
2023-05-09 [email protected] Remove dead code
(flutter/flutter#126266)
2023-05-09 [email protected] fix AppBar's
docs for backgroundColor (flutter/flutter#126194)

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

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 Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AppBar color does not use Theme.colorScheme.primary, or docs are wrong
2 participants