Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created November 9, 2025 15:30
Show Gist options
  • Select an option

  • Save fredgrott/6486bbf82a2a0129da43ad18eb38c220 to your computer and use it in GitHub Desktop.

Select an option

Save fredgrott/6486bbf82a2a0129da43ad18eb38c220 to your computer and use it in GitHub Desktop.
M3E typography Emily's original code
factory M3ETypography.defaultFor(
Brightness brightness, {
String? brandFontFamily,
String? plainFontFamily,
TextTheme? baseOverride,
}) {
// 1) Start from Material 3 baseline type.
final m3 = Typography.material2021();
final TextTheme m3Base =
baseOverride ?? (brightness == Brightness.dark ? m3.white : m3.black);
// 2) Optionally map brand/plain families to role groups (M3E guidance).
final TextTheme baseWithFamilies = _applyFamilies(
m3Base,
brand: brandFontFamily,
plain: plainFontFamily,
);
// 3) Provide emphasized deltas (weights/tracking).
return M3ETypography(
base: baseWithFamilies,
emphasized: M3EEmphasized.forBrightness(brightness),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment