Skip to content

Conversation

@huycozy
Copy link
Member

@huycozy huycozy commented May 20, 2025

This PR is to make AppBarTheme conform to Flutter Material's conventions for component themes:

  • Added a AppBarThemeData class which defines overrides for the defaults for AppBar properties.
  • Added AppBarTheme constructor parameters: AppBarThemeData? data and Widget? child. This is now the preferred way to configure a AppBarTheme:
AppBarTheme(
      data: AppBarThemeData(),
      child: Scaffold(
        appBar: AppBar(
          title: xxx,
          leading: xxx,
          actions: xxx,
     ),
),

These two properties are made nullable to not break existing apps which has customized ThemeData.appBarTheme.

  • Update AppBarTheme to be an InheritedWidget subclass.
  • Changed the type of component theme defaults from AppBarTheme to AppBarThemeData.
  • Add new tests for AppBarThemeData and update the existing AppBarTheme tests.
  • This also temporarily changes AppBarThemeData to Object? in ThemeData class, to bypass g3 tests, following Normalize BottomAppBarTheme #168586 (comment).
  • Addresses the "theme normalization" sub-project within ☂️ Material Theme System Updates #91772.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@huycozy huycozy self-assigned this May 20, 2025
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 20, 2025
@huycozy huycozy force-pushed the appbar-theme-normalization branch from 2465ff1 to fdc4855 Compare May 20, 2025 14:39
@huycozy huycozy marked this pull request as ready for review May 21, 2025 04:52
@huycozy huycozy requested a review from QuncCccccc May 21, 2025 04:52
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #169130 at sha fdc4855

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label May 21, 2025
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

Thank you for adding this normalization! LGTM:)

@huycozy huycozy force-pushed the appbar-theme-normalization branch from a2f78a8 to a6b93c2 Compare May 22, 2025 14:31
@huycozy huycozy mentioned this pull request May 26, 2025
9 tasks
@huycozy huycozy requested a review from QuncCccccc May 29, 2025 04:05
@huycozy huycozy force-pushed the appbar-theme-normalization branch from 6c6feff to f1112fa Compare June 2, 2025 10:31
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM! As for the google testing failures, I'll create g3fix when I come back:)! Thanks!

@QuncCccccc
Copy link
Contributor

Attached a g3fix cl/766370276

@huycozy huycozy added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 18, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 18, 2025

autosubmit label was removed for flutter/flutter/169130, because - The status or check suite Google testing 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 Jun 18, 2025
@QuncCccccc QuncCccccc force-pushed the appbar-theme-normalization branch from 860e402 to 018c4ae Compare June 18, 2025 16:57
@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jun 20, 2025
Merged via the queue into flutter:master with commit 41acbd2 Jun 20, 2025
146 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2025
@huycozy huycozy deleted the appbar-theme-normalization branch June 22, 2025 15:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 23, 2025
flutter/flutter@c7362b4...0ab008a

2025-06-22 [email protected] Roll Skia from 203469ef4672 to fcd1c55da9cc (1 revision) (flutter/flutter#170986)
2025-06-22 [email protected] Roll Dart SDK from e5db5e0f81ba to 98db1db5ff65 (2 revisions) (flutter/flutter#170979)
2025-06-21 [email protected] Normalize input decoration theme (flutter/flutter#168981)
2025-06-21 [email protected] Roll Skia from dceb857b1c47 to 203469ef4672 (1 revision) (flutter/flutter#170959)
2025-06-21 [email protected] Roll Dart SDK from 6325aeacaef4 to e5db5e0f81ba (1 revision) (flutter/flutter#170958)
2025-06-21 [email protected] Roll Dart SDK from a6a3d65e33d7 to 6325aeacaef4 (2 revisions) (flutter/flutter#170955)
2025-06-21 [email protected] Roll Skia from 773188560221 to dceb857b1c47 (1 revision) (flutter/flutter#170954)
2025-06-21 [email protected] Roll Dart SDK from 750eaa028445 to a6a3d65e33d7 (1 revision) (flutter/flutter#170953)
2025-06-21 [email protected] Fix the Japanese IME problem on macOS reported in the following issue. (flutter/flutter#166291)
2025-06-21 [email protected] Roll Fuchsia Test Scripts from IfPORaYjQ2zP4bcq-... to 2wEtX_lDNhHhDNsP6... (flutter/flutter#170946)
2025-06-20 [email protected] Roll Skia from 104460420c48 to 773188560221 (2 revisions) (flutter/flutter#170942)
2025-06-20 [email protected] Normalize AppBarTheme (flutter/flutter#169130)
2025-06-20 [email protected] Close CupertinoContextMenu overlay if the widget is disposed or a new route is pushed (flutter/flutter#170186)
2025-06-20 [email protected] Roll Dart SDK from a554bdd0a2cc to 750eaa028445 (1 revision) (flutter/flutter#170933)
2025-06-20 [email protected] Roll Skia from b638003de37e to 104460420c48 (1 revision) (flutter/flutter#170932)
2025-06-20 [email protected] Roll Packages from 0ec4053 to 7f41e75 (1 revision) (flutter/flutter#170925)
2025-06-20 [email protected] Roll Skia from f1e68950ea7b to b638003de37e (5 revisions) (flutter/flutter#170923)
2025-06-20 [email protected] [licenses_cpp] jun17 (flutter/flutter#170845)

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] 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
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…r#9472)

flutter/flutter@c7362b4...0ab008a

2025-06-22 [email protected] Roll Skia from 203469ef4672 to fcd1c55da9cc (1 revision) (flutter/flutter#170986)
2025-06-22 [email protected] Roll Dart SDK from e5db5e0f81ba to 98db1db5ff65 (2 revisions) (flutter/flutter#170979)
2025-06-21 [email protected] Normalize input decoration theme (flutter/flutter#168981)
2025-06-21 [email protected] Roll Skia from dceb857b1c47 to 203469ef4672 (1 revision) (flutter/flutter#170959)
2025-06-21 [email protected] Roll Dart SDK from 6325aeacaef4 to e5db5e0f81ba (1 revision) (flutter/flutter#170958)
2025-06-21 [email protected] Roll Dart SDK from a6a3d65e33d7 to 6325aeacaef4 (2 revisions) (flutter/flutter#170955)
2025-06-21 [email protected] Roll Skia from 773188560221 to dceb857b1c47 (1 revision) (flutter/flutter#170954)
2025-06-21 [email protected] Roll Dart SDK from 750eaa028445 to a6a3d65e33d7 (1 revision) (flutter/flutter#170953)
2025-06-21 [email protected] Fix the Japanese IME problem on macOS reported in the following issue. (flutter/flutter#166291)
2025-06-21 [email protected] Roll Fuchsia Test Scripts from IfPORaYjQ2zP4bcq-... to 2wEtX_lDNhHhDNsP6... (flutter/flutter#170946)
2025-06-20 [email protected] Roll Skia from 104460420c48 to 773188560221 (2 revisions) (flutter/flutter#170942)
2025-06-20 [email protected] Normalize AppBarTheme (flutter/flutter#169130)
2025-06-20 [email protected] Close CupertinoContextMenu overlay if the widget is disposed or a new route is pushed (flutter/flutter#170186)
2025-06-20 [email protected] Roll Dart SDK from a554bdd0a2cc to 750eaa028445 (1 revision) (flutter/flutter#170933)
2025-06-20 [email protected] Roll Skia from b638003de37e to 104460420c48 (1 revision) (flutter/flutter#170932)
2025-06-20 [email protected] Roll Packages from 0ec4053 to 7f41e75 (1 revision) (flutter/flutter#170925)
2025-06-20 [email protected] Roll Skia from f1e68950ea7b to b638003de37e (5 revisions) (flutter/flutter#170923)
2025-06-20 [email protected] [licenses_cpp] jun17 (flutter/flutter#170845)

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] 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
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
This PR is to make `AppBarTheme` conform to Flutter Material's
conventions for component themes:

- Added a `AppBarThemeData` class which defines overrides for the
defaults for `AppBar` properties.
- Added AppBarTheme constructor parameters: `AppBarThemeData? data` and
`Widget? child`. This is now the preferred way to configure a
`AppBarTheme`:

```dart
AppBarTheme(
      data: AppBarThemeData(),
      child: Scaffold(
        appBar: AppBar(
          title: xxx,
          leading: xxx,
          actions: xxx,
     ),
),
```
These two properties are made nullable to not break existing apps which
has customized `ThemeData.appBarTheme`.

- Update `AppBarTheme` to be an `InheritedWidget` subclass.
- Changed the type of component theme defaults from `AppBarTheme` to
`AppBarThemeData`.
- Add new tests for `AppBarThemeData` and update the existing
`AppBarTheme` tests.
- This also temporarily changes `AppBarThemeData` to `Object?` in
`ThemeData` class, to bypass g3 tests, following
flutter#168586 (comment).
- Addresses the "theme normalization" sub-project within
flutter#91772.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Signed-off-by: huycozy <[email protected]>
Co-authored-by: Qun Cheng <[email protected]>
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9472)

flutter/flutter@c7362b4...0ab008a

2025-06-22 [email protected] Roll Skia from 203469ef4672 to fcd1c55da9cc (1 revision) (flutter/flutter#170986)
2025-06-22 [email protected] Roll Dart SDK from e5db5e0f81ba to 98db1db5ff65 (2 revisions) (flutter/flutter#170979)
2025-06-21 [email protected] Normalize input decoration theme (flutter/flutter#168981)
2025-06-21 [email protected] Roll Skia from dceb857b1c47 to 203469ef4672 (1 revision) (flutter/flutter#170959)
2025-06-21 [email protected] Roll Dart SDK from 6325aeacaef4 to e5db5e0f81ba (1 revision) (flutter/flutter#170958)
2025-06-21 [email protected] Roll Dart SDK from a6a3d65e33d7 to 6325aeacaef4 (2 revisions) (flutter/flutter#170955)
2025-06-21 [email protected] Roll Skia from 773188560221 to dceb857b1c47 (1 revision) (flutter/flutter#170954)
2025-06-21 [email protected] Roll Dart SDK from 750eaa028445 to a6a3d65e33d7 (1 revision) (flutter/flutter#170953)
2025-06-21 [email protected] Fix the Japanese IME problem on macOS reported in the following issue. (flutter/flutter#166291)
2025-06-21 [email protected] Roll Fuchsia Test Scripts from IfPORaYjQ2zP4bcq-... to 2wEtX_lDNhHhDNsP6... (flutter/flutter#170946)
2025-06-20 [email protected] Roll Skia from 104460420c48 to 773188560221 (2 revisions) (flutter/flutter#170942)
2025-06-20 [email protected] Normalize AppBarTheme (flutter/flutter#169130)
2025-06-20 [email protected] Close CupertinoContextMenu overlay if the widget is disposed or a new route is pushed (flutter/flutter#170186)
2025-06-20 [email protected] Roll Dart SDK from a554bdd0a2cc to 750eaa028445 (1 revision) (flutter/flutter#170933)
2025-06-20 [email protected] Roll Skia from b638003de37e to 104460420c48 (1 revision) (flutter/flutter#170932)
2025-06-20 [email protected] Roll Packages from 0ec4053 to 7f41e75 (1 revision) (flutter/flutter#170925)
2025-06-20 [email protected] Roll Skia from f1e68950ea7b to b638003de37e (5 revisions) (flutter/flutter#170923)
2025-06-20 [email protected] [licenses_cpp] jun17 (flutter/flutter#170845)

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] 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 Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
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. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants