|
| 1 | +// Copyright 2014 The Flutter Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +import 'template.dart'; |
| 6 | + |
| 7 | +class ListTileTemplate extends TokenTemplate { |
| 8 | + const ListTileTemplate(super.blockName, super.fileName, super.tokens, { |
| 9 | + super.colorSchemePrefix = '_colors.', |
| 10 | + super.textThemePrefix = '_textTheme.', |
| 11 | + }); |
| 12 | + |
| 13 | + @override |
| 14 | + String generate() => ''' |
| 15 | +class _${blockName}DefaultsM3 extends ListTileThemeData { |
| 16 | + _${blockName}DefaultsM3(this.context) |
| 17 | + : super( |
| 18 | + contentPadding: const EdgeInsetsDirectional.only(start: 16.0, end: 24.0), |
| 19 | + minLeadingWidth: 24, |
| 20 | + minVerticalPadding: 8, |
| 21 | + shape: ${shape("md.comp.list.list-item.container")}, |
| 22 | + ); |
| 23 | +
|
| 24 | + final BuildContext context; |
| 25 | + late final ThemeData _theme = Theme.of(context); |
| 26 | + late final ColorScheme _colors = _theme.colorScheme; |
| 27 | + late final TextTheme _textTheme = _theme.textTheme; |
| 28 | +
|
| 29 | + @override |
| 30 | + Color? get tileColor => Colors.transparent; |
| 31 | +
|
| 32 | + @override |
| 33 | + TextStyle? get titleTextStyle => ${textStyle("md.comp.list.list-item.label-text")}; |
| 34 | +
|
| 35 | + @override |
| 36 | + TextStyle? get subtitleTextStyle => ${textStyle("md.comp.list.list-item.supporting-text")}; |
| 37 | +
|
| 38 | + @override |
| 39 | + TextStyle? get leadingAndTrailingTextStyle => ${textStyle("md.comp.list.list-item.trailing-supporting-text")}; |
| 40 | +
|
| 41 | + @override |
| 42 | + Color? get selectedColor => ${componentColor('md.comp.list.list-item.selected.trailing-icon')}; |
| 43 | +
|
| 44 | + @override |
| 45 | + Color? get iconColor => ${componentColor('md.comp.list.list-item.unselected.trailing-icon')}; |
| 46 | +} |
| 47 | +'''; |
| 48 | +} |
0 commit comments