mirror of
https://github.com/flutter/flutter.git
synced 2026-01-21 21:26:44 +08:00
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 https://github.com/flutter/flutter/issues/91772