GithubHelp home page GithubHelp logo

pro100andrey / theme_extensions_builder Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 350 KB

Theme extensions builder

Home Page: https://pub.dev/packages/theme_extensions_builder

License: MIT License

Kotlin 0.65% Swift 6.05% Objective-C 0.20% Dart 93.11%
builder flutter theme

theme_extensions_builder's People

Contributors

osmanaslancan avatar pro100andrey avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

theme_extensions_builder's Issues

Dynamic types instead of colors - analyzer conflict?

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

MaterialStateProperty not properly generated

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

Analyser Dependency conflict with flutter_bloc, Unique output file for the generated part file.

  1. The analyser dependency is restricted to >=5.10 to <5.3.0 this is too restrictive and results in a conflict with flutter_bloc which has analyser dependency of <5.0.0, i had downgraded the analyser dependency to ^4.7.0 and did face any issues. This could me downgraded to improve compatibility of the library.
  2. The generated part file needs to be unique the library generates part file with .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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.