thema 0.1.0-dev02 copy "thema: ^0.1.0-dev02" to clipboard
thema: ^0.1.0-dev02 copied to clipboard

thema reduces the boilerplate code required to create ThemeExtension classes with macros.

thema #

thema reduces the boilerplate code required to create ThemeExtension classes with macros.

check pub license

Caution

This package is experimental because the Dart macro system is currently under development.
DO NOT USE on production codes.

thema Traditional
thema traditional

Contents #

Requirements #

  • Dart dev channel
  • Flutter master channel

For more information, refer to the Macros documentation.

Setup #

  1. Edit SDK constraints in pubspec.yaml:
environment:
  sdk: ">=3.6.0-0 <4.0.0"
copied to clipboard
  1. Add the following dependencies to your pubspec.yaml:
dependencies:
  thema: <version>
copied to clipboard
  1. Enable the experiment in analysis_options.yaml:
analyzer:
  enable-experiment:
    - macros
    - enhanced-parts
copied to clipboard

Usage #

Define a class with the @Thema annotation:

@Thema()
class ColorThemeExt {
  final Color primaryColor;
  final Color secondaryColor;
  final Color accentColor;
}
copied to clipboard

thema supports custom theme classes:

class GradientColor {
  // You should implement the `lerp` static method.
  static GradientColor? lerp(GradientColor? a, GradientColor? b, double t) {
    // ...
  }
}

@Thema()
class GradientColorThemeExt {
  final GradientColor primaryGradient;
  final GradientColor secondaryGradient;
  final GradientColor accentGradient;
}
copied to clipboard

thema also supports nested ThemeExtension classes:

@Thema()
class AppThemeExt {
  final ColorThemeExt color;
  final GradientColorThemeExt gradientColor;
}
copied to clipboard

Feature requests #

If you have any feature requests, please create an issue from this template.

Bug reports #

If you find any bugs, please create an issue from this template.

Contributing #

Welcome your contributions!! Please read CONTRIBUTING docs before submitting your PR.

2
likes
90
points
23
downloads

Publisher

verified publisherronnnnn.com

Weekly Downloads

2024.09.02 - 2025.03.17

thema reduces the boilerplate code required to create ThemeExtension classes with macros.

Repository (GitHub)
Contributing

Topics

#theme #macros

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

collection, macros

More

Packages that depend on thema