pro100andrey / theme_extensions_builder Goto Github PK
View Code? Open in Web Editor NEWTheme extensions builder
Home Page: https://pub.dev/packages/theme_extensions_builder
License: MIT License
Theme extensions builder
Home Page: https://pub.dev/packages/theme_extensions_builder
License: MIT License
Builder generates
@override
ThemeExtension<AppColors> copyWith({
dynamic primary,
dynamic secondary,
dynamic orangeMedium,
dynamic orangeLight,
from
final Color primary;
final Color secondary;
final Color orangeMedium;
final Color orangeLight;
project uses analyzer: 5.2.0 and build_runner: 2.3.3
Great and easy to use package. Thank you for the good work!
There is a bug when generating MaterialStateProperty properties.
Here is a minimal example for reproduction.
part 'primary_button.g.theme.dart';
@ThemeExtensions(buildContextExtension: false)
class PrimaryButtonTheme extends ThemeExtension<PrimaryButtonTheme>
with _$ThemeExtensionMixin {
final MaterialStateProperty<Color>? backgroundColor;
final MaterialStateProperty<Color>? foregroundColor;
const PrimaryButtonTheme({
this.backgroundColor,
this.foregroundColor,
});
factory PrimaryButtonTheme.def() => PrimaryButtonTheme(
backgroundColor: MMStateProperties.redStateColor,
foregroundColor: MMStateProperties.neutralStateColor,
);
static PrimaryButtonTheme of(BuildContext context) =>
Theme.of(context).extension() ?? PrimaryButtonTheme.def();
}
.g.dart
extension, this conflicts with json_serializable
which also generates the part file with the same name. If this generated part file is renamed to .gte.dart
it will fix the unique output issue reported by build_runner
.Thanks for the very helpful library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.