DevSrSouza / svg-to-compose

Converts SVG and Android Vector Drawable in Compose Multiplatform source code
MIT License
418 stars 36 forks source link

Visual test #10

Open BreimerR opened 2 years ago

BreimerR commented 2 years ago

image

DevSrSouza commented 2 years ago

Hi @BreimerR, could you explain your use case? I did a test here and seems that Compose default Modifier.size() has the same effect side by side.

I think your implementation is perfect to work with applying a base size to the SVG like 32dp is by default, but I think that the name in the Icon should be optional.

image

BreimerR commented 2 years ago

Referenced from: Boiler code reduction. Instead of using Modifier.size(). The commit resizes all the nodes. Thus no need for the Modifier.

@Composable
fun Icon(){
     Icon(Icons.SomeLargeIcon,modifier = Modifier.size(24.dp))
}

Becomes

@Composable
fun SomeLargeIcon(){
     Icon(Icons.SomeLargeIcon24)
}
DevSrSouza commented 2 years ago

I don't think this is a good solution for removing boilerplate, Icons generation generation alot alot alot of code generation that can ingress code size to just not use Modifier.size(). Compose is flexible, you can always create a custom icon function that was size pre defined. I will protype a function for that use case: something like AwesomeIcons.Something.size64

DevSrSouza commented 2 years ago

I still think your PR is awesome but generating multiple icons with difference only on the icon size is not a good a idea in my opinion, but allowing to generate a icon with a specified size would be awesome and this PR also support that. If you are able to open a new PR adding the scale/size functionality would be awesome.