baseStyle static method
Implementation
static TextStyle baseStyle(BuildContext context, UBlockType type) {
final TextTheme t = Theme.of(context).textTheme;
final ColorScheme cs = Theme.of(context).colorScheme;
switch (type) {
case UBlockType.h1:
return (t.headlineMedium ?? const TextStyle(fontSize: 30)).copyWith(fontWeight: FontWeight.bold);
case UBlockType.h2:
return (t.headlineSmall ?? const TextStyle(fontSize: 24)).copyWith(fontWeight: FontWeight.bold);
case UBlockType.h3:
return (t.titleLarge ?? const TextStyle(fontSize: 20)).copyWith(fontWeight: FontWeight.bold);
case UBlockType.h4:
return (t.titleMedium ?? const TextStyle(fontSize: 18)).copyWith(fontWeight: FontWeight.bold);
case UBlockType.h5:
return (t.titleSmall ?? const TextStyle(fontSize: 16)).copyWith(fontWeight: FontWeight.bold);
case UBlockType.h6:
return (t.bodyLarge ?? const TextStyle(fontSize: 15)).copyWith(fontWeight: FontWeight.bold, color: cs.onSurfaceVariant);
case UBlockType.quote:
return (t.bodyLarge ?? const TextStyle(fontSize: 16)).copyWith(fontStyle: FontStyle.italic, color: cs.onSurfaceVariant);
case UBlockType.code:
return (t.bodyMedium ?? const TextStyle(fontSize: 14)).copyWith(fontFamily: "monospace", color: cs.onSurface);
case UBlockType.paragraph:
case UBlockType.bulleted:
case UBlockType.numbered:
case UBlockType.checklist:
case UBlockType.image:
case UBlockType.divider:
case UBlockType.table:
return t.bodyLarge ?? const TextStyle(fontSize: 16);
}
}