KTypography class

K皮肤库的字体排版类,支持自定义字体样式定义

提供了完整的字体排版系统,支持用户定义任意数量的自定义文本样式

Constructors

KTypography({required TextStyle displayLarge, required TextStyle displayMedium, required TextStyle displaySmall, required TextStyle headlineLarge, required TextStyle headlineMedium, required TextStyle headlineSmall, required TextStyle bodyLarge, required TextStyle bodyMedium, required TextStyle bodySmall, required TextStyle labelLarge, required TextStyle labelMedium, required TextStyle labelSmall, Map<String, TextStyle> customStyles = const {}})
const
KTypography.fromJson(Map<String, dynamic> json)
从 JSON 数据创建 KTypography 实例
factory

Properties

allCustomStyleKeys List<String>
获取所有自定义样式键名
no setter
bodyLarge TextStyle
正文大文本样式 - 用于重要正文
final
bodyMedium TextStyle
正文中等文本样式 - 用于普通正文
final
bodySmall TextStyle
正文小文本样式 - 用于辅助文本
final
customStyles Map<String, TextStyle>
自定义文本样式映射 - 支持用户定义的无限文本样式
final
displayLarge TextStyle
显示大文本样式 - 用于重要标题
final
displayMedium TextStyle
显示中等文本样式 - 用于次要标题
final
displaySmall TextStyle
显示小文本样式 - 用于小标题
final
hashCode int
The hash code for this object.
no setteroverride
headlineLarge TextStyle
标题大文本样式 - 用于页面标题
final
headlineMedium TextStyle
标题中等文本样式 - 用于节标题
final
headlineSmall TextStyle
标题小文本样式 - 用于小节标题
final
labelLarge TextStyle
标签大文本样式 - 用于按钮等
final
labelMedium TextStyle
标签中等文本样式 - 用于小按钮等
final
labelSmall TextStyle
标签小文本样式 - 用于标签等
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

applyColor(Color color) KTypography
应用颜色到所有文本样式
applyFontFamily(String fontFamily) KTypography
应用字体族到所有文本样式
copyWith({TextStyle? displayLarge, TextStyle? displayMedium, TextStyle? displaySmall, TextStyle? headlineLarge, TextStyle? headlineMedium, TextStyle? headlineSmall, TextStyle? bodyLarge, TextStyle? bodyMedium, TextStyle? bodySmall, TextStyle? labelLarge, TextStyle? labelMedium, TextStyle? labelSmall, Map<String, TextStyle>? customStyles}) KTypography
复制当前排版并允许修改部分属性
getCustomStyle(String key) TextStyle?
获取自定义文本样式
getCustomStyleOrDefault(String key, TextStyle defaultStyle) TextStyle
获取自定义文本样式,如果不存在则返回默认样式
hasCustomStyle(String key) bool
检查自定义样式是否存在
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
将 KTypography 转换为 JSON 数据
toString() String
A string representation of this object.
override
withCustomStyle(String key, TextStyle style) KTypography
添加或更新自定义文本样式
withoutCustomStyle(String key) KTypography
移除自定义文本样式

Operators

operator ==(Object other) bool
The equality operator.
override

Constants

defaultTypography → const KTypography
默认的排版系统 - 基于 Material Design 3