flutter/dev/tools/gen_defaults/lib/card_template.dart
Darren Austin 33ed6a3533
Fixing elevation issues with Material 3 (#110624)
* Added support for surfaceTintColor and shadowColor to the Dialog widgets.
* Updated the defaults for Material.shadowColor and Material.surfaceTint to allow turning off the features with a transparent color.
* Added support for shadowColor and surfaceTintColor for Drawer widget.
2022-09-06 16:16:45 -07:00

35 lines
1.1 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'template.dart';
class CardTemplate extends TokenTemplate {
const CardTemplate(super.blockName, super.fileName, super.tokens);
@override
String generate() => '''
// Generated version ${tokens["version"]}
class _${blockName}DefaultsM3 extends CardTheme {
const _${blockName}DefaultsM3(this.context)
: super(
clipBehavior: Clip.none,
elevation: ${elevation("md.comp.elevated-card.container")},
margin: const EdgeInsets.all(4.0),
shape: ${shape("md.comp.elevated-card.container")},
);
final BuildContext context;
@override
Color? get color => ${componentColor("md.comp.elevated-card.container")};
@override
Color? get shadowColor => ${colorOrTransparent("md.comp.elevated-card.container.shadow-color")};
@override
Color? get surfaceTintColor => ${colorOrTransparent("md.comp.elevated-card.container.surface-tint-layer.color")};
}
''';
}