Requires G3Fix cl/486997831
This commit is contained in:
@@ -19,6 +19,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:gen_defaults/action_chip_template.dart';
|
||||
import 'package:gen_defaults/app_bar_template.dart';
|
||||
import 'package:gen_defaults/badge_template.dart';
|
||||
import 'package:gen_defaults/banner_template.dart';
|
||||
import 'package:gen_defaults/bottom_app_bar_template.dart';
|
||||
import 'package:gen_defaults/bottom_sheet_template.dart';
|
||||
@@ -54,6 +55,7 @@ Future<void> main(List<String> args) async {
|
||||
const List<String> tokenFiles = <String>[
|
||||
'badge.json',
|
||||
'banner.json',
|
||||
'badge.json',
|
||||
'bottom_app_bar.json',
|
||||
'button_elevated.json',
|
||||
'button_filled.json',
|
||||
@@ -125,6 +127,8 @@ Future<void> main(List<String> args) async {
|
||||
ActionChipTemplate('Chip', '$materialLib/chip.dart', tokens).updateFile();
|
||||
ActionChipTemplate('ActionChip', '$materialLib/action_chip.dart', tokens).updateFile();
|
||||
AppBarTemplate('AppBar', '$materialLib/app_bar.dart', tokens).updateFile();
|
||||
BottomAppBarTemplate('BottomAppBar', '$materialLib/bottom_app_bar.dart', tokens).updateFile();
|
||||
BadgeTemplate('Badge', '$materialLib/badge.dart', tokens).updateFile();
|
||||
BannerTemplate('Banner', '$materialLib/banner.dart', tokens).updateFile();
|
||||
BottomAppBarTemplate('BottomAppBar', '$materialLib/bottom_app_bar.dart', tokens).updateFile();
|
||||
BottomSheetTemplate('BottomSheet', '$materialLib/bottom_sheet.dart', tokens).updateFile();
|
||||
|
||||
36
dev/tools/gen_defaults/lib/badge_template.dart
Normal file
36
dev/tools/gen_defaults/lib/badge_template.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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 BadgeTemplate extends TokenTemplate {
|
||||
const BadgeTemplate(super.blockName, super.fileName, super.tokens, {
|
||||
super.colorSchemePrefix = '_colors.',
|
||||
});
|
||||
|
||||
@override
|
||||
String generate() => '''
|
||||
class _${blockName}DefaultsM3 extends BadgeThemeData {
|
||||
_${blockName}DefaultsM3(this.context) : super(
|
||||
smallSize: ${tokens["md.comp.badge.size"]},
|
||||
largeSize: ${tokens["md.comp.badge.large.size"]},
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
alignment: const AlignmentDirectional(12, -4),
|
||||
);
|
||||
|
||||
final BuildContext context;
|
||||
late final ThemeData _theme = Theme.of(context);
|
||||
late final ColorScheme _colors = _theme.colorScheme;
|
||||
|
||||
@override
|
||||
Color? get backgroundColor => ${color("md.comp.badge.color")};
|
||||
|
||||
@override
|
||||
Color? get textColor => ${color("md.comp.badge.large.label-text.color")};
|
||||
|
||||
@override
|
||||
TextStyle? get textStyle => ${textStyle("md.comp.badge.large.label-text")};
|
||||
}
|
||||
''';
|
||||
}
|
||||
Reference in New Issue
Block a user