theme_code_gen 0.0.1
theme_code_gen: ^0.0.1 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 - @ColorAnotation(), for text - @TextAnotation()).
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.
Usage #
@TextAnotation() class ConstantText { static TextStyle text1 = const TextStyle(fontSize: 33); static TextStyle text2 = const TextStyle(fontSize: 23); }