Normalize Dialog theme (#153982)
This PR is to make preparations to make `DialogTheme` conform to Flutter's conventions for component themes: * Added a `DialogThemeData` class which defines overrides for the defaults for `Dialog` properties. * Added 2 `DialogTheme` constructor parameters: `DialogThemeData? data` and `Widget? child`. This is now the preferred way to configure a `DialogTheme`: ``` DialogTheme( data: DialogThemeData(color: xxx, elevation: xxx, ...), child: Dialog(...) ) ``` These two properties are made nullable to not break existing apps which has customized `ThemeData.dialogTheme`. * Changed the type of theme defaults from `DialogTheme` to `DialogThemeData`. TODO: * Fix internal failures. * Change the type of `ThemeData.dialogTheme` from `DialogTheme` to `DialogThemeData`. 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
This commit is contained in:
@@ -12,7 +12,7 @@ class DialogTemplate extends TokenTemplate {
|
||||
|
||||
@override
|
||||
String generate() => '''
|
||||
class _${blockName}DefaultsM3 extends DialogTheme {
|
||||
class _${blockName}DefaultsM3 extends DialogThemeData {
|
||||
_${blockName}DefaultsM3(this.context)
|
||||
: super(
|
||||
alignment: Alignment.center,
|
||||
@@ -54,7 +54,7 @@ class DialogFullscreenTemplate extends TokenTemplate {
|
||||
|
||||
@override
|
||||
String generate() => '''
|
||||
class _${blockName}DefaultsM3 extends DialogTheme {
|
||||
class _${blockName}DefaultsM3 extends DialogThemeData {
|
||||
const _${blockName}DefaultsM3(this.context): super(clipBehavior: Clip.none);
|
||||
|
||||
final BuildContext context;
|
||||
|
||||
Reference in New Issue
Block a user