-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change generate-class-name for fonts, colors, assets #280
Change generate-class-name for fonts, colors, assets #280
Conversation
c2b4c6c
to
0e66987
Compare
throw const InvalidSettingsException( | ||
'The value of "flutter_gen/colors:" is incorrect.'); | ||
} | ||
|
||
final buffer = StringBuffer(); | ||
final className = genColors.outputs?.className ?? 'FontFamily'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you use FontFamily
in color generator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, I have fixed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, you need to fix unit test @Cu-Toof
pubspecFile, | ||
formatter, | ||
flutterGen.colors, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think you need to update this call formatter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, I have updated this code.
It seems to be duplicated with this PR #279 |
8c66ee6
to
523b494
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Cu-Toof please fix my PR's comments. Btw, you did not add unit test?
README.md
Outdated
@@ -739,16 +739,25 @@ flutter_gen: | |||
# - snake-case | |||
# - dot-delimiter | |||
style: dot-delimiter | |||
# Optional | |||
outputs: | |||
class_name: Assets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add the sample class name as MyAssets
and add the comment with default value is Assets
README.md
Outdated
|
||
fonts: | ||
# Optional | ||
enabled: true | ||
# Optional | ||
outputs: | ||
class_name: FontFamily |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment. FontFamily
is the default generated class name. You should add the sample class name to make it clear
README.md
Outdated
|
||
colors: | ||
# Optional | ||
enabled: true | ||
# Optional | ||
inputs: [] | ||
# Optional | ||
outputs: | ||
class_name: ColorName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment. ColorName
is the default generated class name
} | ||
|
||
String _dotDelimiterStyleAssetsClassDefinition(List<_Statement> statements) { | ||
String _dotDelimiterStyleAssetsClassDefinition( | ||
String? className, List<_Statement> statements) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the current code convention. Please refer https://github.com/FlutterGen/flutter_gen/blob/main/packages/core/lib/generators/assets_generator.dart#L289
} | ||
|
||
String _flatStyleAssetsClassDefinition(List<_Statement> statements) { | ||
String _flatStyleAssetsClassDefinition( | ||
String? className, List<_Statement> statements) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the current code convention. Please refer https://github.com/FlutterGen/flutter_gen/blob/main/packages/core/lib/generators/assets_generator.dart#L289
@@ -47,13 +47,19 @@ flutter_gen: | |||
enabled: true | |||
package_parameter_enabled: false | |||
style: dot-delimiter | |||
outputs: | |||
class_name: Assets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Becoz you checked in this line in Asset, so the default config no need outputs.class_name
param, right?
|
||
colors: | ||
enabled: true | ||
inputs: [] | ||
outputs: | ||
class_name: ColorName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same above comment becoz you checked in this line https://github.com/FlutterGen/flutter_gen/pull/280/files#diff-4f1088f5086a316577b245788f11453e91629f92b823d1fa58936750f6f1f518R26
|
||
fonts: | ||
enabled: true | ||
outputs: | ||
class_name: FontFamily |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment becoz you checked here https://github.com/FlutterGen/flutter_gen/pull/280/files#diff-74b9255cc2b20267c715b8162a5fcd4e4d55b3b0fb333a5bc23b52deb5d207e4R22
I will merge this PR after all fix. @thangnc I appreciate your help. |
523b494
to
055771f
Compare
055771f
to
2fa5eb0
Compare
Change the class name that will be generated.
Update pubspec.yaml file: