-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Normalize Card theme #151914
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
Normalize Card theme #151914
Conversation
1fabdb3
to
dd7b041
Compare
9605643
to
ef8f64b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great update for consistent API. LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I wonder if you can also introduce a fix now, for replacing individual properties
CardTheme(clipBehavior: ...) ⇒ CardTheme(data: CardThemeData(clipBehavior: ...))
|
||
/// Overrides the default value for [Card.clipBehavior]. | ||
/// | ||
/// This property is obsolete: please use the [CardThemeData.clipBehavior] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and below
/// This property is obsolete: please use the [CardThemeData.clipBehavior] | |
/// This property is obsolete and will be deprecated in a future release: please use the [CardThemeData.clipBehavior] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a fix
Dart fix can't help with this one unfortunately. We looked at it a bunch of ways, but since the class CardTheme itself will still exist undeprecated, we can't auto migrate it to CardThemeData.
|
||
/// Creates a copy of this object with the given fields replaced with the | ||
/// new values. | ||
CardTheme copyWith({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a mention that this will be deprecated
/// Linearly interpolate between two Card themes. | ||
/// | ||
/// {@macro dart.ui.shadow.lerp} | ||
static CardTheme lerp(CardTheme? a, CardTheme? b, double t) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a note that this will be deprecated
3986622
to
f16e813
Compare
Manual roll requested by [email protected] flutter/flutter@9d5ede0...85960d2 2024-07-30 [email protected] Fix Shortcut label for CharacterActivator does not include modifiers (flutter/flutter#152233) 2024-07-30 [email protected] [wiki] Remove text saying wiki edits do not get code reviewed (flutter/flutter#152530) 2024-07-30 [email protected] Roll Flutter Engine from cb96743cc955 to c58d87d62c20 (1 revision) (flutter/flutter#152527) 2024-07-30 [email protected] Add `find.backButton` finder and `StandardComponentType` enum to find components in tests. (flutter/flutter#149349) 2024-07-30 [email protected] Roll Flutter Engine from 49324cd0b678 to cb96743cc955 (4 revisions) (flutter/flutter#152524) 2024-07-30 [email protected] [devicelab] remove Skia specific and unused devicelab metrics. (flutter/flutter#152523) 2024-07-30 [email protected] Add Dimil Kalathiya to authors (flutter/flutter#152491) 2024-07-29 [email protected] Roll Flutter Engine from 240fb460675d to 49324cd0b678 (4 revisions) (flutter/flutter#152521) 2024-07-29 [email protected] Stop CupertinoScrollbar's track from paging the scroll view on tap (flutter/flutter#152197) 2024-07-29 [email protected] Roll Flutter Engine from 4ef0f0d988ec to 240fb460675d (1 revision) (flutter/flutter#152507) 2024-07-29 [email protected] Roll Flutter Engine from a0219f7a429c to 4ef0f0d988ec (1 revision) (flutter/flutter#152505) 2024-07-29 [email protected] [flutter_tools] remove raster stats CLI option. (flutter/flutter#152501) 2024-07-29 [email protected] Shift some mac Android tests to Mokey devices in staging (flutter/flutter#152499) 2024-07-29 [email protected] [devicelab] enable impeller in external texture test. (flutter/flutter#152502) 2024-07-29 [email protected] Roll Flutter Engine from d1995f302c4d to a0219f7a429c (2 revisions) (flutter/flutter#152500) 2024-07-29 [email protected] Roll Flutter Engine from d803bb16c8b0 to d1995f302c4d (4 revisions) (flutter/flutter#152496) 2024-07-29 [email protected] Normalize Card theme (flutter/flutter#151914) 2024-07-29 [email protected] Roll Flutter Engine from 2db47a1f3d0d to d803bb16c8b0 (1 revision) (flutter/flutter#152489) 2024-07-29 [email protected] Roll Packages from 3d358d9 to 247fb5f (8 revisions) (flutter/flutter#152488) 2024-07-29 [email protected] Update New-Android-version.md (flutter/flutter#152395) 2024-07-29 [email protected] Roll Flutter Engine from 510f19a7e629 to 2db47a1f3d0d (1 revision) (flutter/flutter#152485) 2024-07-29 [email protected] Roll Flutter Engine from 87cbf33b9028 to 510f19a7e629 (1 revision) (flutter/flutter#152473) 2024-07-29 [email protected] Roll Flutter Engine from 2cf3986cae52 to 87cbf33b9028 (2 revisions) (flutter/flutter#152469) 2024-07-29 [email protected] Add tests for deletable_chip_attributes.on_deleted.0.dart (flutter/flutter#152361) 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] 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
This PR is to make preparations to make `CardTheme` conform to Flutter's conventions for component themes: * Added a `CardThemeData` class which defines overrides for the defaults for `Card` properties. * Added 2 `CardTheme` constructor parameters: `CardThemeData? data` and `Widget? child`. This is now the preferred way to configure a `CardTheme`: ```dart CardTheme( data: CardThemeData(color: xxx, elevation: xxx, ...), child: Card(...) ) ``` These two properties are made nullable to not break existing apps which has customized `ThemeData.cardTheme`. * Changed the type of theme defaults from `CardTheme` to `CardThemeData`. TODO: * Fix internal failures that may have breakages. * Change the type of `ThemeData.cardTheme` from `CardTheme` to `CardThemeData`. This may cause breaking changes, a migration guide will be created. Addresses the "theme normalization" sub project within flutter#91772
This PR is to make preparations to make `CardTheme` conform to Flutter's conventions for component themes: * Added a `CardThemeData` class which defines overrides for the defaults for `Card` properties. * Added 2 `CardTheme` constructor parameters: `CardThemeData? data` and `Widget? child`. This is now the preferred way to configure a `CardTheme`: ```dart CardTheme( data: CardThemeData(color: xxx, elevation: xxx, ...), child: Card(...) ) ``` These two properties are made nullable to not break existing apps which has customized `ThemeData.cardTheme`. * Changed the type of theme defaults from `CardTheme` to `CardThemeData`. TODO: * Fix internal failures that may have breakages. * Change the type of `ThemeData.cardTheme` from `CardTheme` to `CardThemeData`. This may cause breaking changes, a migration guide will be created. Addresses the "theme normalization" sub project within flutter#91772
Following #151914, this PR is to normalize `ThemeData.cardTheme`; change the `CardTheme cardTheme` property to `CardThemeData cardTheme` in `ThemeData`. In `ThemeData()` and `ThemeData.copyWith()`, the `cardTheme` parameter type is changed to `Object?` to accept both `CardTheme` and `CardThemeData` so that we won't cause immediate breaking change and make sure rolling is smooth. Once all component themes are normalized, these `Object?` types should be changed to `xxxThemeData`. There's no way to create a dart fix because we can't add a "@deprecated" label for `CardTheme` because `CardTheme` is a new InheritedWidget subclass now. Addresses the "theme normalization" sub project within #91772
This PR is to make preparations to make
CardTheme
conform to Flutter's conventions for component themes:CardThemeData
class which defines overrides for the defaults forCard
properties.CardTheme
constructor parameters:CardThemeData? data
andWidget? child
. This is now the preferred way to configure aCardTheme
:These two properties are made nullable to not break existing apps which has customized
ThemeData.cardTheme
.CardTheme
toCardThemeData
.TODO:
ThemeData.cardTheme
fromCardTheme
toCardThemeData
. This may cause breaking changes, a migration guide will be created.Addresses the "theme normalization" sub project within #91772
Pre-launch Checklist
///
).