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"
  1. Add the following dependencies to your pubspec.yaml:
dependencies:
  thema: <version>
  1. Enable the experiment in analysis_options.yaml:
analyzer:
  enable-experiment:
    - macros
    - enhanced-parts

Usage #

Define a class with the @Thema annotation:

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

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;
}

thema also supports nested ThemeExtension classes:

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

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
80
pub points
0%
popularity

Publisher

verified publisherronnnnn.com

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

Repository (GitHub)
View/report issues
Contributing

Topics

#theme #macros

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

collection, macros

More

Packages that depend on thema