KThemeManager class

K皮肤库的主题管理器 - 单例模式

负责管理应用的主题状态,包括:

  • 当前主题的切换和管理
  • 主题变更的通知
  • 主题的持久化存储
  • 主题列表的管理
Inheritance

Properties

currentTheme KThemeData
获取当前主题
no setter
currentThemeId String
获取当前主题ID
no setter
darkThemes List<KThemeData>
获取暗色主题列表
no setter
debugInfo String
获取调试信息
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
lightThemes List<KThemeData>
获取亮色主题列表
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
themeIds List<String>
获取所有主题ID列表
no setter
themeNames List<String>
获取所有主题名称列表
no setter
themes Map<String, KThemeData>
获取所有主题列表
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addTheme(KThemeData theme, {bool makeActive = false}) → void
添加主题
addThemeChangeCallback(VoidCallback callback) → void
添加主题变更回调
addThemes(List<KThemeData> themes, {String? activeThemeId}) → void
批量添加主题
clearCustomThemes() → void
清除所有自定义主题(保留默认主题)
clearThemeChangeCallbacks() → void
清除所有主题变更回调
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
exportAllThemes() Map<String, dynamic>
导出所有主题为JSON
exportCurrentTheme() Map<String, dynamic>
导出当前主题为JSON
exportTheme(String themeId) Map<String, dynamic>?
导出指定主题为JSON
findThemeByName(String name) KThemeData?
根据名称查找主题
findThemesByAuthor(String author) List<KThemeData>
根据作者查找主题
getStatistics() Map<String, dynamic>
获取主题统计信息
getTheme(String themeId) KThemeData?
获取指定主题
getThemeOrDefault(String themeId, {KThemeData? defaultTheme}) KThemeData
获取主题,如果不存在则返回默认主题
hasTheme(String themeId) bool
检查主题是否存在
importThemesFromJson(Map<String, dynamic> json) → void
从导出的JSON导入主题
loadThemeFromAssets(String assetPath, {String? skinBasePath}) Future<KThemeData?>
从assets加载主题
loadThemeFromJson(Map<String, dynamic> json, {String? skinBasePath}) KThemeData?
从JSON数据加载主题
loadThemeFromJsonString(String jsonString, {String? skinBasePath}) KThemeData?
从JSON字符串加载主题
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeTheme(String themeId) bool
移除主题
removeThemeChangeCallback(VoidCallback callback) → void
移除主题变更回调
reset() → void
重置到默认状态
switchTheme(String themeId) bool
切换主题
switchToNextTheme() → void
切换到下一个主题
switchToPreviousTheme() → void
切换到上一个主题
toString() String
A string representation of this object.
inherited
validateTheme(String themeId) Future<Map<String, dynamic>>
验证主题完整性

Operators

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

Static Properties

instance KThemeManager
no setter