Skip to content

Conversation

@Cu-Toof
Copy link
Contributor

@Cu-Toof Cu-Toof commented Aug 15, 2022

Change the class name that will be generated.
Update pubspec.yaml file:

flutter_gen:
  output: lib/gen/

  assets:
    outputs:
      class_name: AppAssets //default is Assets

  fonts:
    outputs:
      class_name: AppFontFamily //default is FontFamily

  colors:
    inputs:
      - assets/colors/colors.xml 
    outputs:
      class_name: AppColor //default is ColorName

@Cu-Toof Cu-Toof force-pushed the feature/change-gen-class-name-for-fonts-colors-assets branch from c2b4c6c to 0e66987 Compare August 15, 2022 14:48
}

final buffer = StringBuffer();
final className = genColors.outputs?.className ?? 'FontFamily';
Copy link

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?

Copy link
Contributor Author

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.

Copy link

@thangnc thangnc left a 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,
);
Copy link

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?

Copy link
Contributor Author

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.

@thangnc
Copy link

thangnc commented Aug 17, 2022

It seems to be duplicated with this PR #279

@Cu-Toof Cu-Toof force-pushed the feature/change-gen-class-name-for-fonts-colors-assets branch 2 times, most recently from 8c66ee6 to 523b494 Compare August 18, 2022 14:02
@wasabeef wasabeef requested a review from thangnc August 21, 2022 05:44
@Cu-Toof
Copy link
Contributor Author

Cu-Toof commented Aug 21, 2022

@thangnc I have reviewed this PR #279.
I think we can custom more than one output's information. But this pr is implementing output_class is just string type.
Replace it, I implement output as an object, code is scalable with other output's customize like file name, prefix name...

Copy link

@thangnc thangnc left a 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
style: dot-delimiter
# Optional
outputs:
class_name: Assets
Copy link

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
enabled: true
# Optional
outputs:
class_name: FontFamily
Copy link

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
inputs: []
# Optional
outputs:
class_name: ColorName
Copy link

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) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


String _flatStyleAssetsClassDefinition(List<_Statement> statements) {
String _flatStyleAssetsClassDefinition(
String? className, List<_Statement> statements) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package_parameter_enabled: false
style: dot-delimiter
outputs:
class_name: Assets
Copy link

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?

enabled: true
inputs: []
outputs:
class_name: ColorName
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fonts:
enabled: true
outputs:
class_name: FontFamily
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wasabeef wasabeef added this to the 4.4.0 milestone Aug 21, 2022
@wasabeef
Copy link
Member

I will merge this PR after all fix.

@thangnc I appreciate your help.

@Cu-Toof Cu-Toof force-pushed the feature/change-gen-class-name-for-fonts-colors-assets branch from 523b494 to 055771f Compare September 2, 2022 01:48
@Cu-Toof Cu-Toof closed this Sep 2, 2022
@Cu-Toof Cu-Toof force-pushed the feature/change-gen-class-name-for-fonts-colors-assets branch from 055771f to 2fa5eb0 Compare September 2, 2022 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants