theme_code_gen 0.0.7 copy "theme_code_gen: ^0.0.7" to clipboard
theme_code_gen: ^0.0.7 copied to clipboard

Package that uses code generation to create custom colors, fonts, etc.

Package that uses code generation to create custom colors, fonts, etc.

Features #

Using the familiar flutter pub run build_runner build command and anotations, you can generate your own code to create the appropriate ThemeExtension

Getting started #

Add the following packages to your pubspec.yaml file:

  • build_runner
  • current package

Сreate a class with your custom colours or textual styles (all fields should be "static") and label the class with the appropriate annotation (for colours - @color_anotation, for text - @text_anotation).

Don't forget to add the following line

  • part '-your file name-.g.dart';

Run the following command

  • flutter pub run build_runner build

You will get the generated files, with the ThemeExtension ready. After generating the files, you must remove all dependencies (theme_code_get). Each color must have a realization "Dark" and "Light". Be sure to use each color at the end of the name "Light" or "Dark".

Usage #

@text_anotation
class ConstantText {
  static TextStyle text1 = const TextStyle(fontSize: 33);
  static TextStyle text2 = const TextStyle(fontSize: 23);
}
@color_anotation
class ConstantColor {
  static const bgLight = Color(0xFF489D91);
  static const bgDark = Color(0xFF489D91);
}
2
likes
0
points
247
downloads

Publisher

unverified uploader

Weekly Downloads

Package that uses code generation to create custom colors, fonts, etc.

License

unknown (license)

Dependencies

analyzer, build, code_builder, flutter, source_gen

More

Packages that depend on theme_code_gen