Add support for Material 3 Divider and VerticalDivider (#112655)

This commit is contained in:
Darren Austin
2022-09-29 11:30:53 -07:00
committed by GitHub
parent 0fe6d60300
commit 2bf83dd860
12 changed files with 445 additions and 37 deletions

View File

@@ -24,6 +24,7 @@ import 'package:gen_defaults/button_template.dart';
import 'package:gen_defaults/card_template.dart';
import 'package:gen_defaults/checkbox_template.dart';
import 'package:gen_defaults/dialog_template.dart';
import 'package:gen_defaults/divider_template.dart';
import 'package:gen_defaults/fab_template.dart';
import 'package:gen_defaults/filter_chip_template.dart';
import 'package:gen_defaults/icon_button_template.dart';
@@ -65,6 +66,7 @@ Future<void> main(List<String> args) async {
'date_picker_docked.json',
'date_picker_modal.json',
'dialog.json',
'divider.json',
'dialog_fullscreen.json',
'elevation.json',
'fab_extended_primary.json',
@@ -122,6 +124,7 @@ Future<void> main(List<String> args) async {
CheckboxTemplate('Checkbox', '$materialLib/checkbox.dart', tokens).updateFile();
DialogFullscreenTemplate('DialogFullscreen', '$materialLib/dialog.dart', tokens).updateFile();
DialogTemplate('Dialog', '$materialLib/dialog.dart', tokens).updateFile();
DividerTemplate('Divider', '$materialLib/divider.dart', tokens).updateFile();
FABTemplate('FAB', '$materialLib/floating_action_button.dart', tokens).updateFile();
FilterChipTemplate('ChoiceChip', '$materialLib/choice_chip.dart', tokens).updateFile();
FilterChipTemplate('FilterChip', '$materialLib/filter_chip.dart', tokens).updateFile();

View File

@@ -0,0 +1,25 @@
// 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 DividerTemplate extends TokenTemplate {
const DividerTemplate(super.blockName, super.fileName, super.tokens);
@override
String generate() => '''
class _${blockName}DefaultsM3 extends DividerThemeData {
const _${blockName}DefaultsM3(this.context) : super(
space: 16,
thickness: ${tokens["md.comp.divider.thickness"]},
indent: 0,
endIndent: 0,
);
final BuildContext context;
@override Color? get color => ${componentColor("md.comp.divider")};
}
''';
}