Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Normalize BottomAppBarTheme #168586

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 7 commits into from
May 14, 2025

Conversation

huycozy
Copy link
Member

@huycozy huycozy commented May 9, 2025

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

  • Added a BottomAppBarThemeData class which defines overrides for the defaults for BottomAppBar properties.
  • Added BottomAppBarTheme constructor parameters: BottomAppBarThemeData? data and Widget? child. This is now the preferred way to configure a BottomAppBarTheme:
BottomAppBarTheme(
	data: BottomAppBarThemeData(
	    color: xxx,
	    height: xxx,
	    elevation: xxx,
	    shape: xxx,
	    ...
	  ),
  	child: const BottomAppBar()
)

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

  • Update BottomAppBarTheme to be an InheritedWidget subclass.
  • Changed the type of component theme defaults from BottomAppBarTheme to BottomAppBarThemeData.
  • Changed the BottomAppBarTheme bottomAppBarTheme property to BottomAppBarThemeData bottomAppBarTheme in ThemeData and ThemeData.copyWith(). This may cause breaking changes, a migration guide will be created on website repo.
  • Add new tests for BottomAppBarThemeData and update the existing BottomAppBarTheme tests. And also turn to true for useMaterial3 (along with usages accordingly) at the common method _withTheme() since useMaterial3 is true by default.
  • 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 requested review from Piinks and QuncCccccc May 9, 2025 07:58
@huycozy huycozy self-assigned this May 9, 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 9, 2025
@huycozy huycozy removed request for Piinks and QuncCccccc May 9, 2025 08:56
@huycozy huycozy marked this pull request as draft May 9, 2025 08:56
@flutter-dashboard

This comment was marked as outdated.

@huycozy huycozy force-pushed the bottom-appbar-theme-normalization branch 3 times, most recently from 20bdbc2 to 71d59a6 Compare May 9, 2025 11:53
@huycozy huycozy marked this pull request as ready for review May 9, 2025 14:30
@QuncCccccc QuncCccccc self-requested a review May 9, 2025 17:16
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 so much for helping make some progress on the theme system cleanup!! This looks great! Just left some comments.

@huycozy huycozy force-pushed the bottom-appbar-theme-normalization branch from 71d59a6 to 5270b9c Compare May 12, 2025 11:42
@huycozy huycozy force-pushed the bottom-appbar-theme-normalization branch from 5270b9c to d178dbd Compare May 12, 2025 15:39
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! Thanks for helping add this! Please do not submit this for now. Let's see if the google testing will be triggered. The test recently is not super stable.

@huycozy huycozy force-pushed the bottom-appbar-theme-normalization branch from 1328134 to 43c1667 Compare May 13, 2025 06:28
@huycozy huycozy force-pushed the bottom-appbar-theme-normalization branch from 43c1667 to 4d071ab Compare May 13, 2025 07:55
@huycozy
Copy link
Member Author

huycozy commented May 14, 2025

Thanks to @bleroux's PR #168724, spotted out a few places that need cleanup here too! Pushed a commit 766c94f for this.

@huycozy huycozy requested a review from QuncCccccc May 14, 2025 04:21
@auto-submit auto-submit bot added this pull request to the merge queue May 14, 2025
Merged via the queue into flutter:master with commit 494b08b May 14, 2025
150 of 151 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 15, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request May 15, 2025
flutter/flutter@0b9f928...9a78af5

2025-05-15 [email protected] Manual pub package roll (flutter/flutter#168916)
2025-05-15 [email protected] Remove unnecessary `bringup: true` for release-channel only `Linux flutter_packaging`. (flutter/flutter#168761)
2025-05-15 [email protected] Revert: "Run `flutter_packaging` builders on release candidates (flutter/flutter#168917)
2025-05-15 [email protected] Roll Dart SDK from a6c25e31caa7 to c9640c3a4440 (1 revision) (flutter/flutter#168911)
2025-05-15 [email protected] Roll Packages from 1468581 to 2dff621 (4 revisions) (flutter/flutter#168908)
2025-05-15 [email protected] Roll Dart SDK from b3520981e0f0 to a6c25e31caa7 (11 revisions) (flutter/flutter#168895)
2025-05-15 [email protected] Roll Fuchsia Linux SDK from fSvuEJgRmHxnewRJr... to Jj-iDG5uPOsFgY2_H... (flutter/flutter#168893)
2025-05-15 [email protected] Fix mac_ios_engine_ddm config with missing ci/ios_debug_sim_ddm config (flutter/flutter#168888)
2025-05-15 [email protected] [native assets] Remove `KernelSnapshot` dependency in build (flutter/flutter#168742)
2025-05-15 [email protected] iOS,macOS: Migrate logging to Logger/FlutterLogger (flutter/flutter#168568)
2025-05-15 [email protected] Skip hot reload breakpoints test when running with web (flutter/flutter#168873)
2025-05-15 [email protected] CupertinoSliverNavigationBar respects accessibility text scaling (flutter/flutter#168866)
2025-05-15 [email protected] [display_list] paint cleanup. (flutter/flutter#168082)
2025-05-15 [email protected] Add a new CI build for iOS DDM-enabled artifacts (flutter/flutter#168717)
2025-05-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Implements UISceneDelegate dynamically w/ FlutterLaunchEngine (#168396)" (flutter/flutter#168880)
2025-05-14 [email protected] Implements UISceneDelegate dynamically w/ FlutterLaunchEngine (flutter/flutter#168396)
2025-05-14 [email protected] Mark web_tool_tests_1_2 as bringup. (flutter/flutter#168871)
2025-05-14 [email protected] Marks Mac_mokey run_debug_test_android to be unflaky (flutter/flutter#167634)
2025-05-14 [email protected] Reland "Clip search artifacts in CupertinoSliverNavigationBar searchable-to-searchable transitions" (flutter/flutter#168772)
2025-05-14 [email protected] Remove references to `team-release`. (flutter/flutter#168780)
2025-05-14 [email protected] Make Cupertino sheet set the systemUIStyle through an AnnotatedRegion (flutter/flutter#168182)
2025-05-14 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Use live region in error text input decorator for Android (#165531)" (flutter/flutter#168848)
2025-05-14 [email protected] Normalize BottomAppBarTheme (flutter/flutter#168586)
2025-05-14 [email protected] Roll Packages from 2e166de to 1468581 (2 revisions) (flutter/flutter#168828)
2025-05-14 [email protected] macOS,iOS: fix swift target triple (flutter/flutter#168749)
2025-05-14 [email protected] Further update `Engine-artifacts.md`. (flutter/flutter#168779)

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
@QuncCccccc
Copy link
Contributor

I'll be working on fixing the google testing once the PR to change theme type from Object? to BottomAppBarThemeData is ready:) No rush at all!!

@huycozy
Copy link
Member Author

huycozy commented May 16, 2025

I'll be working on fixing the google testing once the PR to change theme type from Object? to BottomAppBarThemeData is ready:) No rush at all!!

Thank you! I filed #168966 following this.

@huycozy huycozy deleted the bottom-appbar-theme-normalization branch May 19, 2025 04:11
@huycozy huycozy mentioned this pull request May 20, 2025
9 tasks
github-merge-queue bot pushed a commit that referenced this pull request May 21, 2025
This is following #168586:

See
#168586 (comment)
for the context of this.

## 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]>
@rydmike
Copy link
Contributor

rydmike commented May 25, 2025

FYI @huycozy, this change breaks builds using the FlexColorScheme package, as have all past migrations of this type.

See report: rydmike/flex_color_scheme#283

The package in a few places returns:

BottomAppBarTheme bottomAppBarTheme(...) {... return BottomAppBarTheme(...)}

To create a custom version of BottomAppBarTheme (Data).

The package also requires explicit type specifications of all types, which this migration does not consider. Because of this, this change breaks any build that uses lint require_all_types, like Flutter repo does, and happens to specify and return the old none "normalized" class BottomAppBarTheme for the bottom app bars's component theme data.

The fix is of course simple enough, just change all refs to BottomAppBarTheme with BottomAppBarThemeData. However, as the usage of BottomAppBarThemeData for this purpose is not included in latest stable Flutter (3.32.x) there is no way to release a single package version that supports Flutter stable and master channels at the same time.

This of course may cause friction among FlexColorScheme users that venture to the master channel, as shown in example issue above.

For most of the the earlier component theme normalizations, I noticed that the parallel usage of both ComponentXTheme and ComponentXThemeData, had first been allowed to reach stable channel, before the ComponentXThemeData was removed from the API in master channel.

This way an update to use the new ComponentXThemeData could be released in packages, that was compatible with latest stable and beta/master at same time. Not so in this case.

Why was this not done in this case?


The change of course also updates a number of internal tests that would fail and not compile if they had not been fixed. Which of course is one of the marks of a breaking change.

@huycozy
Copy link
Member Author

huycozy commented May 26, 2025

Thanks for sharing your case, @rydmike!

However, as the usage of BottomAppBarThemeData for this purpose is not included in latest stable Flutter (3.32.x) there is no way to release a single package version that supports Flutter stable and master channels at the same time.

Along with this PR, I also filed the breaking change documentation PR at flutter/website#12057 ( it's not ready for review yet as I need to wait for #169130 (AppBarTheme normalization) and #168981 (InputDecorationTheme normalization) to land first. And I'm unfortunately also not sure which stable or beta release will pack this commit.

For most of the the earlier component theme normalizations, I noticed that the parallel usage of both ComponentXTheme and ComponentXThemeData, had first been allowed to reach stable channel, before the ComponentXThemeData was removed from the API in master channel.

This way an update to use the new ComponentXThemeData could be released in packages, that was compatible with latest stable and beta/master at same time. Not so in this case.

This sounds a bit strange compared to the release process I'm familiar with, see Flutter's channels. Could you please elaborate on this? Typically, the fix/commit is ​​landed on main/master first, then beta and stable. Maybe @QuncCccccc can help us figure out how to achieve this or verify if this is correct and helpful for users in the release process, and for similar PRs in the future (if there are any more)?

@QuncCccccc
Copy link
Contributor

For most of the the earlier component theme normalizations, I noticed that the parallel usage of both ComponentXTheme and ComponentXThemeData, had first been allowed to reach stable channel, before the ComponentXThemeData was removed from the API in master channel.

This way an update to use the new ComponentXThemeData could be released in packages, that was compatible with latest stable and beta/master at same time. Not so in this case.

Sorry for the inconvenience! I think we kept BottomAppBarTheme actually in this PR. We currently don't have any plan to remove the existing properties in BottomAppBarTheme so we should be able to use them. Could you provide some code sample how this PR causes the breakages? We can help to fix them if needed!

This PR #168966 will cause breaking changes because we change the type of ThemeData.bottomAppBarTheme from Object? to BottomAppBarThemeData. @huycozy Maybe we can push the migration guide now for bottomAppBarTheme normalization, and then keep updating it once the other 2 components are ready:)

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.

3 participants