Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename to _M3Typography
  • Loading branch information
ValentinVignal committed Oct 6, 2026
commit 1fa90c934e08bd441a96078c30982f5476ed1652
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// packages/material_ui/tool/gen_defaults/bin/gen_defaults.dart.
part of '../typography.dart';

abstract final class _TypographyDefaultsM3 {
abstract final class _M3Typography {
static const TextTheme englishLike = TextTheme(
displayLarge: TextStyle(
debugLabel: 'englishLike displayLarge 2021',
Expand Down
6 changes: 3 additions & 3 deletions packages/material_ui/lib/src/typography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2070,18 +2070,18 @@ class Typography with Diagnosticable {
///
/// The font sizes, weights, and letter spacings in this version match the
/// [2021 Material Design 3 specification](https://m3.material.io/styles/typography/overview).
static const TextTheme englishLike2021 = _TypographyDefaultsM3.englishLike;
static const TextTheme englishLike2021 = _M3Typography.englishLike;

/// Defines text geometry for dense scripts, such as Chinese, Japanese
/// and Korean.
///
/// The Material Design 3 specification does not include 'dense' text themes,
/// so this is just here to be consistent with the API.
static const TextTheme dense2021 = _TypographyDefaultsM3.dense;
static const TextTheme dense2021 = _M3Typography.dense;

/// Defines text geometry for tall scripts, such as Farsi, Hindi, and Thai.
///
/// The Material Design 3 specification does not include 'tall' text themes,
/// so this is just here to be consistent with the API.
static const TextTheme tall2021 = _TypographyDefaultsM3.tall;
static const TextTheme tall2021 = _M3Typography.tall;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class TypographyTemplateM3 extends TokenTemplateM3 {
@override
String get parentFilePath => 'typography.dart';

@override
String get className => '_M3Typography';

@override
String generateContents(String className) =>
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ void main() {
test('TypographyTemplateM3 emits M3 Typography defaults from tokens', () {
const template = TypographyTemplateM3();
final String contents = _generateContents(template);
expect(contents, contains('abstract final class _TypographyDefaultsM3'));
expect(contents, contains('abstract final class _M3Typography'));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test expects the generated class to be named _M3Typography, but the new TypographyTemplateM3 generates _TypographyDefaultsM3 (as seen in the generated file). This will cause the test to fail. Please update the assertion to expect _TypographyDefaultsM3.

Suggested change
expect(contents, contains('abstract final class _M3Typography'));
expect(contents, contains('abstract final class _TypographyDefaultsM3'));

expect(contents, contains('displayLarge: TextStyle('));
expect(contents, contains("debugLabel: 'englishLike displayLarge 2021'"));
});
Expand Down