From dd23547e9d8b2fd96c67e6054041eb912dc80769 Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Thu, 26 Jun 2025 11:37:30 +0530 Subject: [PATCH 1/6] Add deprecation breaking change for app bar color --- .../breaking-changes/appbar-theme-color.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/content/release/breaking-changes/appbar-theme-color.md diff --git a/src/content/release/breaking-changes/appbar-theme-color.md b/src/content/release/breaking-changes/appbar-theme-color.md new file mode 100644 index 0000000000..d37bc5ef5f --- /dev/null +++ b/src/content/release/breaking-changes/appbar-theme-color.md @@ -0,0 +1,118 @@ +--- +title: AppBar theme color parameter deprecation +description: >- + The color parameter in AppBarTheme and AppBarThemeData has been + deprecated in favor of backgroundColor for better API consistency. +--- + +## Summary + +The `color` parameter in `AppBarTheme` and `AppBarThemeData` constructors +and their `copyWith` methods has been deprecated. Use `backgroundColor` +instead. This change affects how AppBar themes are configured and may +cause deprecation warnings in existing code. + +## Background + +The AppBar theming system had two parameters that controlled the same +property: `color` and `backgroundColor`. This duplication created confusion +and inconsistency in the API. To improve clarity and consistency, the +`color` parameter has been deprecated in favor of `backgroundColor`. + +The deprecation affects the following classes and methods: + +- `AppBarTheme` constructor +- `AppBarTheme.copyWith` method +- `AppBarThemeData` constructor +- `AppBarThemeData.copyWith` method + +When using the deprecated `color` parameter, you'll see warnings like: + +``` +'color' is deprecated and shouldn't be used. Use backgroundColor instead. +This feature was deprecated after v3.33.0-0.2.pre. +``` + +The classes also include assertion checks to prevent using both parameters +simultaneously: + +``` +The color and backgroundColor parameters mean the same thing. Only specify one. +``` + +## Migration guide + +Replace all uses of the `color` parameter with `backgroundColor` in +AppBarTheme and AppBarThemeData constructors and copyWith methods. + +Code before migration: + +```dart +// AppBarTheme constructor +AppBarTheme( + color: Colors.blue, + elevation: 4.0, +) + +// AppBarTheme copyWith +theme.copyWith( + color: Colors.red, + elevation: 2.0, +) + +// AppBarThemeData constructor +AppBarThemeData( + color: Colors.green, + elevation: 4.0, +) + +// AppBarThemeData copyWith +themeData.copyWith( + color: Colors.purple, + elevation: 2.0, +) +``` + +Code after migration: + +```dart +// AppBarTheme constructor +AppBarTheme( + backgroundColor: Colors.blue, + elevation: 4.0, +) + +// AppBarTheme copyWith +theme.copyWith( + backgroundColor: Colors.red, + elevation: 2.0, +) + +// AppBarThemeData constructor +AppBarThemeData( + backgroundColor: Colors.green, + elevation: 4.0, +) + +// AppBarThemeData copyWith +themeData.copyWith( + backgroundColor: Colors.purple, + elevation: 2.0, +) +``` + +## Timeline + +Landed in version: 3.33.0-0.2.pre
+In stable release: Not yet + +## References + +API documentation: + +- [`AppBarTheme`](https://master-api.flutter.dev/flutter/material/AppBarTheme-class.html) +- [`AppBarThemeData`](https://master-api.flutter.dev/flutter/material/AppBarThemeData-class.html) + +Relevant PRs: + +- [AppBar theme color parameter deprecation #170624](https://github.com/flutter/flutter/pull/170624) From b863354889a2605081cf236d03d1a166bd70e13c Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Fri, 27 Jun 2025 07:01:26 +0530 Subject: [PATCH 2/6] Update src/content/release/breaking-changes/appbar-theme-color.md Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com> --- src/content/release/breaking-changes/appbar-theme-color.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/release/breaking-changes/appbar-theme-color.md b/src/content/release/breaking-changes/appbar-theme-color.md index d37bc5ef5f..d4ec0f3e0c 100644 --- a/src/content/release/breaking-changes/appbar-theme-color.md +++ b/src/content/release/breaking-changes/appbar-theme-color.md @@ -8,7 +8,7 @@ description: >- ## Summary The `color` parameter in `AppBarTheme` and `AppBarThemeData` constructors -and their `copyWith` methods has been deprecated. Use `backgroundColor` +and their `copyWith` methods hasve been deprecated. Use `backgroundColor` instead. This change affects how AppBar themes are configured and may cause deprecation warnings in existing code. From 43a27c50541907a3e524d7a48d227552489f39bb Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Fri, 27 Jun 2025 07:01:39 +0530 Subject: [PATCH 3/6] Update src/content/release/breaking-changes/appbar-theme-color.md Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com> --- src/content/release/breaking-changes/appbar-theme-color.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/release/breaking-changes/appbar-theme-color.md b/src/content/release/breaking-changes/appbar-theme-color.md index d4ec0f3e0c..ef82a15d83 100644 --- a/src/content/release/breaking-changes/appbar-theme-color.md +++ b/src/content/release/breaking-changes/appbar-theme-color.md @@ -43,7 +43,7 @@ The color and backgroundColor parameters mean the same thing. Only specify one. ## Migration guide Replace all uses of the `color` parameter with `backgroundColor` in -AppBarTheme and AppBarThemeData constructors and copyWith methods. +`AppBarTheme` and `AppBarThemeData` constructors and `copyWith` methods. Code before migration: From 001fcbd29b2c4ab5123249c05129fdb3d5287129 Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Fri, 27 Jun 2025 07:01:57 +0530 Subject: [PATCH 4/6] Update src/content/release/breaking-changes/appbar-theme-color.md Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com> --- src/content/release/breaking-changes/appbar-theme-color.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/release/breaking-changes/appbar-theme-color.md b/src/content/release/breaking-changes/appbar-theme-color.md index ef82a15d83..8b63c9797f 100644 --- a/src/content/release/breaking-changes/appbar-theme-color.md +++ b/src/content/release/breaking-changes/appbar-theme-color.md @@ -110,8 +110,8 @@ In stable release: Not yet API documentation: -- [`AppBarTheme`](https://master-api.flutter.dev/flutter/material/AppBarTheme-class.html) -- [`AppBarThemeData`](https://master-api.flutter.dev/flutter/material/AppBarThemeData-class.html) +- [`AppBarTheme`](https://main-api.flutter.dev/flutter/material/AppBarTheme-class.html) +- [`AppBarThemeData`](https://main-api.flutter.dev/flutter/material/AppBarThemeData-class.html) Relevant PRs: From e35055b19cc925481eaa20ebeb9c44afa12ddc50 Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Fri, 27 Jun 2025 07:02:14 +0530 Subject: [PATCH 5/6] Update src/content/release/breaking-changes/appbar-theme-color.md Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com> --- src/content/release/breaking-changes/appbar-theme-color.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/release/breaking-changes/appbar-theme-color.md b/src/content/release/breaking-changes/appbar-theme-color.md index 8b63c9797f..3654b2e784 100644 --- a/src/content/release/breaking-changes/appbar-theme-color.md +++ b/src/content/release/breaking-changes/appbar-theme-color.md @@ -115,4 +115,4 @@ API documentation: Relevant PRs: -- [AppBar theme color parameter deprecation #170624](https://github.com/flutter/flutter/pull/170624) +- [AppBar theme color parameter deprecation #170624]({{site.github}}/flutter/flutter/pull/170624) From 5713da54d13a27a04a8f02b6c007645607b17300 Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Fri, 27 Jun 2025 07:42:36 +0530 Subject: [PATCH 6/6] Update index.md --- src/content/release/breaking-changes/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/release/breaking-changes/index.md b/src/content/release/breaking-changes/index.md index a1cd297c20..7d89e35ae2 100644 --- a/src/content/release/breaking-changes/index.md +++ b/src/content/release/breaking-changes/index.md @@ -50,6 +50,7 @@ They're sorted by release and listed in alphabetical order: * [Component theme normalization updates][] [Redesigned the Radio Widget]: /release/breaking-changes/radio-api-redesign +[Deprecate app bar color]: /release/breaking-changes/appbar-theme-color [Removed semantics elevation and thickness]: /release/breaking-changes/remove-semantics-elevation-and-thickness [Deprecate `TextField.canRequestFocus`]: /release/breaking-changes/can-request-focus [Stop generating `AssetManifest.json`]: /release/breaking-changes/asset-manifest-dot-json