Refactor gen_defaults to support multiple generated code blocks in the same file independently. (#107278)
This commit is contained in:
@@ -876,7 +876,7 @@ class _AppBarState extends State<AppBar> {
|
||||
assert(debugCheckHasMaterialLocalizations(context));
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final AppBarTheme appBarTheme = AppBarTheme.of(context);
|
||||
final AppBarTheme defaults = theme.useMaterial3 ? _TokenDefaultsM3(context) : _DefaultsM2(context);
|
||||
final AppBarTheme defaults = theme.useMaterial3 ? _AppBarDefaultsM3(context) : _AppBarDefaultsM2(context);
|
||||
final ScaffoldState? scaffold = Scaffold.maybeOf(context);
|
||||
final ModalRoute<dynamic>? parentRoute = ModalRoute.of(context);
|
||||
|
||||
@@ -2284,8 +2284,9 @@ mixin _ScrollUnderFlexibleConfig {
|
||||
EdgeInsetsGeometry? get expandedTitlePadding;
|
||||
}
|
||||
|
||||
class _DefaultsM2 extends AppBarTheme {
|
||||
_DefaultsM2(this.context)
|
||||
// Hand coded defaults based on Material Design 2.
|
||||
class _AppBarDefaultsM2 extends AppBarTheme {
|
||||
_AppBarDefaultsM2(this.context)
|
||||
: super(
|
||||
elevation: 4.0,
|
||||
shadowColor: const Color(0xFF000000),
|
||||
@@ -2313,15 +2314,17 @@ class _DefaultsM2 extends AppBarTheme {
|
||||
TextStyle? get titleTextStyle => _theme.textTheme.headline6;
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - AppBar
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends AppBarTheme {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _AppBarDefaultsM3 extends AppBarTheme {
|
||||
_AppBarDefaultsM3(this.context)
|
||||
: super(
|
||||
elevation: 0.0,
|
||||
scrolledUnderElevation: 3.0,
|
||||
@@ -2421,4 +2424,4 @@ class _LargeScrollUnderFlexibleConfig with _ScrollUnderFlexibleConfig {
|
||||
EdgeInsetsGeometry? get expandedTitlePadding => const EdgeInsets.fromLTRB(16, 0, 16, 28);
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - AppBar
|
||||
|
||||
@@ -161,7 +161,7 @@ class Card extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CardTheme cardTheme = CardTheme.of(context);
|
||||
final CardTheme defaults = Theme.of(context).useMaterial3 ? _TokenDefaultsM3(context) : _DefaultsM2(context);
|
||||
final CardTheme defaults = Theme.of(context).useMaterial3 ? _CardDefaultsM3(context) : _CardDefaultsM2(context);
|
||||
|
||||
return Semantics(
|
||||
container: semanticContainer,
|
||||
@@ -186,8 +186,9 @@ class Card extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _DefaultsM2 extends CardTheme {
|
||||
const _DefaultsM2(this.context)
|
||||
// Hand coded defaults based on Material Design 2.
|
||||
class _CardDefaultsM2 extends CardTheme {
|
||||
const _CardDefaultsM2(this.context)
|
||||
: super(
|
||||
clipBehavior: Clip.none,
|
||||
elevation: 1.0,
|
||||
@@ -206,15 +207,18 @@ class _DefaultsM2 extends CardTheme {
|
||||
Color? get shadowColor => Theme.of(context).shadowColor;
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - Card
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Token database version: v0_101
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends CardTheme {
|
||||
const _TokenDefaultsM3(this.context)
|
||||
class _CardDefaultsM3 extends CardTheme {
|
||||
const _CardDefaultsM3(this.context)
|
||||
: super(
|
||||
clipBehavior: Clip.none,
|
||||
elevation: 1.0,
|
||||
@@ -234,4 +238,4 @@ class _TokenDefaultsM3 extends CardTheme {
|
||||
Color? get surfaceTintColor => Theme.of(context).colorScheme.surfaceTint;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - Card
|
||||
|
||||
@@ -149,7 +149,7 @@ class ActionChip extends StatelessWidget implements ChipAttributes, TappableChip
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
final ChipThemeData? defaults = Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context, isEnabled)
|
||||
? _ActionChipDefaultsM3(context, isEnabled)
|
||||
: null;
|
||||
return RawChip(
|
||||
defaultProperties: defaults,
|
||||
@@ -178,15 +178,17 @@ class ActionChip extends StatelessWidget implements ChipAttributes, TappableChip
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - ActionChip
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ChipThemeData {
|
||||
const _TokenDefaultsM3(this.context, this.isEnabled)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _ActionChipDefaultsM3 extends ChipThemeData {
|
||||
const _ActionChipDefaultsM3(this.context, this.isEnabled)
|
||||
: super(
|
||||
elevation: 0.0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8.0), topRight: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0))),
|
||||
@@ -248,4 +250,4 @@ class _TokenDefaultsM3 extends ChipThemeData {
|
||||
)!;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - ActionChip
|
||||
|
||||
@@ -177,7 +177,7 @@ class ChoiceChip extends StatelessWidget
|
||||
assert(debugCheckHasMaterial(context));
|
||||
final ChipThemeData chipTheme = ChipTheme.of(context);
|
||||
final ChipThemeData? defaults = Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context, isEnabled, selected)
|
||||
? _FilterChipDefaultsM3(context, isEnabled, selected)
|
||||
: null;
|
||||
return RawChip(
|
||||
defaultProperties: defaults,
|
||||
@@ -211,15 +211,17 @@ class ChoiceChip extends StatelessWidget
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - FilterChip
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ChipThemeData {
|
||||
const _TokenDefaultsM3(this.context, this.isEnabled, this.isSelected)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _FilterChipDefaultsM3 extends ChipThemeData {
|
||||
const _FilterChipDefaultsM3(this.context, this.isEnabled, this.isSelected)
|
||||
: super(
|
||||
elevation: 0.0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8.0), topRight: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0))),
|
||||
@@ -288,4 +290,4 @@ class _TokenDefaultsM3 extends ChipThemeData {
|
||||
)!;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - FilterChip
|
||||
|
||||
@@ -215,7 +215,7 @@ class FilterChip extends StatelessWidget
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
final ChipThemeData? defaults = Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context, isEnabled, selected)
|
||||
? _FilterChipDefaultsM3(context, isEnabled, selected)
|
||||
: null;
|
||||
return RawChip(
|
||||
defaultProperties: defaults,
|
||||
@@ -250,15 +250,17 @@ class FilterChip extends StatelessWidget
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - FilterChip
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ChipThemeData {
|
||||
const _TokenDefaultsM3(this.context, this.isEnabled, this.isSelected)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _FilterChipDefaultsM3 extends ChipThemeData {
|
||||
const _FilterChipDefaultsM3(this.context, this.isEnabled, this.isSelected)
|
||||
: super(
|
||||
elevation: 0.0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8.0), topRight: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0))),
|
||||
@@ -327,4 +329,4 @@ class _TokenDefaultsM3 extends ChipThemeData {
|
||||
)!;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - FilterChip
|
||||
|
||||
@@ -206,7 +206,7 @@ class InputChip extends StatelessWidget
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
final ChipThemeData? defaults = Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context, isEnabled)
|
||||
? _InputChipDefaultsM3(context, isEnabled)
|
||||
: null;
|
||||
final Widget? resolvedDeleteIcon = deleteIcon
|
||||
?? (Theme.of(context).useMaterial3 ? const Icon(Icons.clear, size: 18) : null);
|
||||
@@ -249,15 +249,17 @@ class InputChip extends StatelessWidget
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - InputChip
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ChipThemeData {
|
||||
const _TokenDefaultsM3(this.context, this.isEnabled)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _InputChipDefaultsM3 extends ChipThemeData {
|
||||
const _InputChipDefaultsM3(this.context, this.isEnabled)
|
||||
: super(
|
||||
elevation: 0.0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8.0), topRight: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0))),
|
||||
@@ -319,4 +321,4 @@ class _TokenDefaultsM3 extends ChipThemeData {
|
||||
)!;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - InputChip
|
||||
|
||||
@@ -135,7 +135,7 @@ class Dialog extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final DialogTheme dialogTheme = DialogTheme.of(context);
|
||||
final DialogTheme defaults = theme.useMaterial3 ? _TokenDefaultsM3(context) : _DefaultsM2(context);
|
||||
final DialogTheme defaults = theme.useMaterial3 ? _DialogDefaultsM3(context) : _DialogDefaultsM2(context);
|
||||
|
||||
final EdgeInsets effectivePadding = MediaQuery.of(context).viewInsets + (insetPadding ?? EdgeInsets.zero);
|
||||
return AnimatedPadding(
|
||||
@@ -522,7 +522,7 @@ class AlertDialog extends StatelessWidget {
|
||||
assert(debugCheckHasMaterialLocalizations(context));
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final DialogTheme dialogTheme = DialogTheme.of(context);
|
||||
final DialogTheme defaults = theme.useMaterial3 ? _TokenDefaultsM3(context) : _DefaultsM2(context);
|
||||
final DialogTheme defaults = theme.useMaterial3 ? _DialogDefaultsM3(context) : _DialogDefaultsM2(context);
|
||||
|
||||
String? label = semanticLabel;
|
||||
switch (theme.platform) {
|
||||
@@ -1275,12 +1275,9 @@ double _paddingScaleFactor(double textScaleFactor) {
|
||||
return lerpDouble(1.0, 1.0 / 3.0, clampedTextScaleFactor - 1.0)!;
|
||||
}
|
||||
|
||||
// Generate a DialogTheme that represents the M2 default values.
|
||||
// This was generated by hand from the previous hand coded defaults
|
||||
// for M2. It uses get method overrides instead of properties to
|
||||
// avoid computing values that we may not need upfront.
|
||||
class _DefaultsM2 extends DialogTheme {
|
||||
_DefaultsM2(this.context)
|
||||
// Hand coded defaults based on Material Design 2.
|
||||
class _DialogDefaultsM2 extends DialogTheme {
|
||||
_DialogDefaultsM2(this.context)
|
||||
: _textTheme = Theme.of(context).textTheme,
|
||||
_iconTheme = Theme.of(context).iconTheme,
|
||||
super(
|
||||
@@ -1309,15 +1306,17 @@ class _DefaultsM2 extends DialogTheme {
|
||||
EdgeInsetsGeometry? get actionsPadding => EdgeInsets.zero;
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - Dialog
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends DialogTheme {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _DialogDefaultsM3 extends DialogTheme {
|
||||
_DialogDefaultsM3(this.context)
|
||||
: super(
|
||||
alignment: Alignment.center,
|
||||
elevation: 6.0,
|
||||
@@ -1345,4 +1344,4 @@ class _TokenDefaultsM3 extends DialogTheme {
|
||||
EdgeInsetsGeometry? get actionsPadding => const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0);
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - Dialog
|
||||
|
||||
@@ -339,7 +339,7 @@ class ElevatedButton extends ButtonStyleButton {
|
||||
final ColorScheme colorScheme = theme.colorScheme;
|
||||
|
||||
return Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context)
|
||||
? _ElevatedButtonDefaultsM3(context)
|
||||
: styleFrom(
|
||||
backgroundColor: colorScheme.primary,
|
||||
foregroundColor: colorScheme.onPrimary,
|
||||
@@ -506,15 +506,17 @@ class _ElevatedButtonWithIconChild extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - ElevatedButton
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ButtonStyle {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _ElevatedButtonDefaultsM3 extends ButtonStyle {
|
||||
_ElevatedButtonDefaultsM3(this.context)
|
||||
: super(
|
||||
animationDuration: kThemeChangeDuration,
|
||||
enableFeedback: true,
|
||||
@@ -626,4 +628,4 @@ class _TokenDefaultsM3 extends ButtonStyle {
|
||||
InteractiveInkFeatureFactory? get splashFactory => Theme.of(context).splashFactory;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - ElevatedButton
|
||||
|
||||
@@ -151,13 +151,14 @@ class _ElevationOpacity {
|
||||
final double opacity;
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - SurfaceTint
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
// Token database version: v0_101
|
||||
|
||||
// Surface tint opacities based on elevations according to the
|
||||
// Material Design 3 specification:
|
||||
@@ -172,4 +173,4 @@ const List<_ElevationOpacity> _surfaceTintElevationOpacities = <_ElevationOpacit
|
||||
_ElevationOpacity(12.0, 0.14), // Elevation level 5
|
||||
];
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - SurfaceTint
|
||||
|
||||
@@ -513,8 +513,8 @@ class FloatingActionButton extends StatelessWidget {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final FloatingActionButtonThemeData floatingActionButtonTheme = theme.floatingActionButtonTheme;
|
||||
final FloatingActionButtonThemeData defaults = theme.useMaterial3
|
||||
? _TokenDefaultsM3(context, _floatingActionButtonType, child != null)
|
||||
: _M2Defaults(context, _floatingActionButtonType, child != null);
|
||||
? _FABDefaultsM3(context, _floatingActionButtonType, child != null)
|
||||
: _FABDefaultsM2(context, _floatingActionButtonType, child != null);
|
||||
|
||||
final Color foregroundColor = this.foregroundColor
|
||||
?? floatingActionButtonTheme.foregroundColor
|
||||
@@ -727,13 +727,9 @@ class _RenderChildOverflowBox extends RenderAligningShiftedBox {
|
||||
}
|
||||
}
|
||||
|
||||
// Generate a FloatingActionButtonThemeData that represents
|
||||
// the M2 default values. This was generated by hand from the
|
||||
// previous hand coded defaults for M2. It uses get method overrides
|
||||
// instead of properties to avoid computing values that we may not
|
||||
// need upfront.
|
||||
class _M2Defaults extends FloatingActionButtonThemeData {
|
||||
_M2Defaults(BuildContext context, this.type, this.hasChild)
|
||||
// Hand coded defaults based on Material Design 2.
|
||||
class _FABDefaultsM2 extends FloatingActionButtonThemeData {
|
||||
_FABDefaultsM2(BuildContext context, this.type, this.hasChild)
|
||||
: _theme = Theme.of(context),
|
||||
_colors = Theme.of(context).colorScheme,
|
||||
super(
|
||||
@@ -780,15 +776,17 @@ class _M2Defaults extends FloatingActionButtonThemeData {
|
||||
@override TextStyle? get extendedTextStyle => _theme.textTheme.button!.copyWith(letterSpacing: 1.2);
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - FAB
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends FloatingActionButtonThemeData {
|
||||
_TokenDefaultsM3(this.context, this.type, this.hasChild)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _FABDefaultsM3 extends FloatingActionButtonThemeData {
|
||||
_FABDefaultsM3(this.context, this.type, this.hasChild)
|
||||
: super(
|
||||
elevation: 6.0,
|
||||
focusElevation: 6.0,
|
||||
@@ -855,4 +853,4 @@ class _TokenDefaultsM3 extends FloatingActionButtonThemeData {
|
||||
@override TextStyle? get extendedTextStyle => _textTheme.labelLarge;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - FAB
|
||||
|
||||
@@ -775,7 +775,7 @@ class _IconButtonM3 extends ButtonStyleButton {
|
||||
/// * `splashFactory` - Theme.splashFactory
|
||||
@override
|
||||
ButtonStyle defaultStyleOf(BuildContext context) {
|
||||
return _TokenDefaultsM3(context);
|
||||
return _IconButtonDefaultsM3(context);
|
||||
}
|
||||
|
||||
/// Returns null because [IconButton] doesn't have its component theme.
|
||||
@@ -883,15 +883,17 @@ class _IconButtonDefaultMouseCursor extends MaterialStateProperty<MouseCursor> w
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - IconButton
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ButtonStyle {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _IconButtonDefaultsM3 extends ButtonStyle {
|
||||
_IconButtonDefaultsM3(this.context)
|
||||
: super(
|
||||
animationDuration: kThemeChangeDuration,
|
||||
enableFeedback: true,
|
||||
@@ -992,4 +994,4 @@ class _TokenDefaultsM3 extends ButtonStyle {
|
||||
InteractiveInkFeatureFactory? get splashFactory => Theme.of(context).splashFactory;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - IconButton
|
||||
|
||||
@@ -1173,11 +1173,12 @@ bool _isForwardOrCompleted(Animation<double> animation) {
|
||||
}
|
||||
|
||||
NavigationBarThemeData _defaultsFor(BuildContext context) {
|
||||
return Theme.of(context).useMaterial3 ? _TokenDefaultsM3(context) : _Defaults(context);
|
||||
return Theme.of(context).useMaterial3 ? _NavigationBarDefaultsM3(context) : _NavigationBarDefaultsM2(context);
|
||||
}
|
||||
|
||||
class _Defaults extends NavigationBarThemeData {
|
||||
_Defaults(BuildContext context)
|
||||
// Hand coded defaults based on Material Design 2.
|
||||
class _NavigationBarDefaultsM2 extends NavigationBarThemeData {
|
||||
_NavigationBarDefaultsM2(BuildContext context)
|
||||
: _theme = Theme.of(context),
|
||||
_colors = Theme.of(context).colorScheme,
|
||||
super(
|
||||
@@ -1190,7 +1191,7 @@ class _Defaults extends NavigationBarThemeData {
|
||||
final ThemeData _theme;
|
||||
final ColorScheme _colors;
|
||||
|
||||
// With Material 3, the NavigationBar uses an overlay blend for the
|
||||
// With Material 2, the NavigationBar uses an overlay blend for the
|
||||
// default color regardless of light/dark mode.
|
||||
@override Color? get backgroundColor => ElevationOverlay.colorWithOverlay(_colors.surface, _colors.onSurface, 3.0);
|
||||
|
||||
@@ -1206,15 +1207,17 @@ class _Defaults extends NavigationBarThemeData {
|
||||
@override MaterialStateProperty<TextStyle?>? get labelTextStyle => MaterialStatePropertyAll<TextStyle?>(_theme.textTheme.overline!.copyWith(color: _colors.onSurface));
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - NavigationBar
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends NavigationBarThemeData {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _NavigationBarDefaultsM3 extends NavigationBarThemeData {
|
||||
_NavigationBarDefaultsM3(this.context)
|
||||
: super(
|
||||
height: 80.0,
|
||||
elevation: 3.0,
|
||||
@@ -1254,4 +1257,4 @@ class _TokenDefaultsM3 extends NavigationBarThemeData {
|
||||
}
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - NavigationBar
|
||||
|
||||
@@ -379,7 +379,7 @@ class _NavigationRailState extends State<NavigationRail> with TickerProviderStat
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final NavigationRailThemeData navigationRailTheme = NavigationRailTheme.of(context);
|
||||
final NavigationRailThemeData defaults = Theme.of(context).useMaterial3 ? _TokenDefaultsM3(context) : _DefaultsM2(context);
|
||||
final NavigationRailThemeData defaults = Theme.of(context).useMaterial3 ? _NavigationRailDefaultsM3(context) : _NavigationRailDefaultsM2(context);
|
||||
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
|
||||
|
||||
final Color backgroundColor = widget.backgroundColor ?? navigationRailTheme.backgroundColor ?? defaults.backgroundColor!;
|
||||
@@ -910,8 +910,9 @@ const Widget _verticalSpacer = SizedBox(height: 8.0);
|
||||
const double _verticalIconLabelSpacingM3 = 4.0;
|
||||
const double _verticalDestinationSpacingM3 = 12.0;
|
||||
|
||||
class _DefaultsM2 extends NavigationRailThemeData {
|
||||
_DefaultsM2(BuildContext context)
|
||||
// Hand coded defaults based on Material Design 2.
|
||||
class _NavigationRailDefaultsM2 extends NavigationRailThemeData {
|
||||
_NavigationRailDefaultsM2(BuildContext context)
|
||||
: _theme = Theme.of(context),
|
||||
_colors = Theme.of(context).colorScheme,
|
||||
super(
|
||||
@@ -953,15 +954,17 @@ class _DefaultsM2 extends NavigationRailThemeData {
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - NavigationRail
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends NavigationRailThemeData {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _NavigationRailDefaultsM3 extends NavigationRailThemeData {
|
||||
_NavigationRailDefaultsM3(this.context)
|
||||
: super(
|
||||
elevation: 0.0,
|
||||
groupAlignment: -1,
|
||||
@@ -1003,4 +1006,4 @@ class _TokenDefaultsM3 extends NavigationRailThemeData {
|
||||
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - NavigationRail
|
||||
|
||||
@@ -306,7 +306,7 @@ class OutlinedButton extends ButtonStyleButton {
|
||||
final ColorScheme colorScheme = theme.colorScheme;
|
||||
|
||||
return Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context)
|
||||
? _OutlinedButtonDefaultsM3(context)
|
||||
: styleFrom(
|
||||
foregroundColor: colorScheme.primary,
|
||||
disabledForegroundColor: colorScheme.onSurface.withOpacity(0.38),
|
||||
@@ -438,15 +438,17 @@ class _OutlinedButtonWithIconChild extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - OutlinedButton
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ButtonStyle {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _OutlinedButtonDefaultsM3 extends ButtonStyle {
|
||||
_OutlinedButtonDefaultsM3(this.context)
|
||||
: super(
|
||||
animationDuration: kThemeChangeDuration,
|
||||
enableFeedback: true,
|
||||
@@ -542,4 +544,4 @@ class _TokenDefaultsM3 extends ButtonStyle {
|
||||
InteractiveInkFeatureFactory? get splashFactory => Theme.of(context).splashFactory;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - OutlinedButton
|
||||
|
||||
@@ -327,7 +327,7 @@ class TextButton extends ButtonStyleButton {
|
||||
final ColorScheme colorScheme = theme.colorScheme;
|
||||
|
||||
return Theme.of(context).useMaterial3
|
||||
? _TokenDefaultsM3(context)
|
||||
? _TextButtonDefaultsM3(context)
|
||||
: styleFrom(
|
||||
foregroundColor: colorScheme.primary,
|
||||
disabledForegroundColor: colorScheme.onSurface.withOpacity(0.38),
|
||||
@@ -483,15 +483,17 @@ class _TextButtonWithIconChild extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - TextButton
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Generated version v0_101
|
||||
class _TokenDefaultsM3 extends ButtonStyle {
|
||||
_TokenDefaultsM3(this.context)
|
||||
// Token database version: v0_101
|
||||
|
||||
class _TextButtonDefaultsM3 extends ButtonStyle {
|
||||
_TextButtonDefaultsM3(this.context)
|
||||
: super(
|
||||
animationDuration: kThemeChangeDuration,
|
||||
enableFeedback: true,
|
||||
@@ -580,4 +582,4 @@ class _TokenDefaultsM3 extends ButtonStyle {
|
||||
InteractiveInkFeatureFactory? get splashFactory => Theme.of(context).splashFactory;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - TextButton
|
||||
|
||||
@@ -729,13 +729,15 @@ class Typography with Diagnosticable {
|
||||
static const TextTheme tall2021 = _M3Typography.tall;
|
||||
}
|
||||
|
||||
// BEGIN GENERATED TOKEN PROPERTIES
|
||||
// BEGIN GENERATED TOKEN PROPERTIES - Typography
|
||||
|
||||
// Generated code to the end of this file. Do not edit by hand.
|
||||
// These defaults are generated from the Material Design Token
|
||||
// database by the script dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
// Do not edit by hand. The code between the "BEGIN GENERATED" and
|
||||
// "END GENERATED" comments are generated from data in the Material
|
||||
// Design token database by the script:
|
||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||
|
||||
// Token database version: v0_101
|
||||
|
||||
// Generated version v0_101
|
||||
class _M3Typography {
|
||||
_M3Typography._();
|
||||
|
||||
@@ -794,4 +796,4 @@ class _M3Typography {
|
||||
);
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES
|
||||
// END GENERATED TOKEN PROPERTIES - Typography
|
||||
|
||||
Reference in New Issue
Block a user