搜索插件、代码仓与 APP 分类

插件详情v0.0.4

theme_manager_plus

不再提供主题数据。使用您的主题类自定义主题

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
24
喜欢数
20
Pub 分数
150

安装插件

flutter pub add theme_manager_plus

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

ThemeManagerPlus 通过允许开发者定义自定义主题类,简化了 Flutter 应用中的主题管理,消除了重复的主题数据。它提供了一种简洁、可重用的方法,用于在跨平台环境中处理亮色和暗色模式主题。该包内置支持 Android、iOS、Web、macOS、Windows 和 Linux,确保一致的用户界面体验。通过直观的 API,该包简化了主题切换和自定义,非常适合需要动态主题且代码量最少的应用。

适合场景

  • 动态主题切换
  • 跨平台主题一致性
  • 自定义主题类实现
  • 浅色和深色模式管理
  • 应用范围的主题自定义

主要特点

  • 自定义主题类支持
  • 内置的亮色/暗色模式切换
  • 平台无关的设计
  • 最小的样板代码
  • 与现有代码的轻松集成

适合对象

  • 具有复杂主题需求的 Flutter 应用
  • 寻求可重用主题逻辑的开发者
  • 跨平台应用程序
  • 需要用户主题偏好设置的应用
  • 强调清洁架构的项目

使用建议

  • 需要理解 Flutter 的主题系统
  • 可能需要额外的状态管理
  • 不适合简单的静态主题
  • 依赖于正确的初始化
  • 除了基本设置外,文档有限

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

theme_manager_plus

Say goodbye to the hassle of remembering complex color schemes! With Theme Manager Plus, managing themes is a breeze. Simply create a class for light and dark themes, tweak your desired colors and styles, and enjoy a seamless and modern app experience. No more headaches, just easy and efficient theme management!

simulator-screen-recording-iphone-15-pro-2024-01-31-at-214253_5zDSZU03-ezgif com-video-to-gif-converter

Getting started

First, add theme_manager_plus as a dependency in your pubspec.yaml file

theme_manager_plus: ^[version]

Create Your own class which defines colors and styles which you have to inject e.g

class AppTheme {
  Color? backgroundColor;
  TextStyle? heading;
  TextStyle? subheading;

  AppTheme({this.backgroundColor, this.heading, this.subheading});
}

Wrap your material app with the ThemeMangerWrapper and assign your light and dark theme and set the current theme to initial theme you want

home:ThemeManagerPlus<AppTheme>(
          currentTheme: lightTheme,
          darkTheme: Darktheme,
          lightTheme: lightTheme,
          child: MyApp()),
    );

Access data from theme

context.themeOf<AppTheme>()?.backgroundColor

Note: Replace your class name with the custom class name

Change current theme with theme manager plus

 context.changeCurrentTheme<AppTheme>();

Check current theme is dark theme

bool isDarkMode context.isDarkMode<AppTheme>();

Contribution 🤝

Feel free to contribute and open pull requests. 🙌

Issues and Feedback 🐛

Feel free to post a feature requests or report a bug here.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。