0 purchases
c scheme gen
C-Scheme Gen #
This is a package of generators. Currently, you can generate a color scheme from a class of static colors.
example. #
in file colors.dart add
part 'colors.g.dart';
copied to clipboard
to the top of the file
and add annotation
@generateColorScheme
copied to clipboard
to the class
@generateColorScheme
class MyColors
static Color get extra => const Color(0xFF003359);
}
copied to clipboard
This will generate an extension to colorscheme
extension MyColorsExtension on ColorScheme {
Color get extra => MyColors.extra;
}
copied to clipboard
The reason you might want this is so that you can access the colors through the context in widgets like so
Theme.of(context).colorScheme.extra
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.