Skip to content
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

Background Color #5

Open
davidcantonnadales opened this issue Jun 9, 2021 · 3 comments
Open

Background Color #5

davidcantonnadales opened this issue Jun 9, 2021 · 3 comments

Comments

@davidcantonnadales
Copy link

Can export the background color with the rest of SVG items?

Thanks

@psk907
Copy link
Owner

psk907 commented Jun 9, 2021

@gaznerviozzo can you please elaborate on this?

@davidcantonnadales
Copy link
Author

Oh yes sorry for the short description.

I added a background color selector:

image

But when i save the avatar, background color is not exported with the rest of the avatar:

image

I think the backgroundColor property of the CircleAvatar is not valid

          Padding(
                padding: const EdgeInsets.symmetric(vertical: 30),
                child: FluttermojiCircleAvatar(
                  backgroundColor: currentColor,
                  radius: 100,
                ),
              ),

@psk907
Copy link
Owner

psk907 commented Jun 12, 2021

When you save, the setFluttermoji() function is called on the FluttermojiController, here we will encode the selectedIndexes Map and store it as a string using shared preferences under the key: fluttermojiSelectedOptions .

If the background color attribute you've added is not being saved, it's most likely because you aren't actually saving it in the first place , in a map that looks like this -

{
  'backgroundColor': <value>,
  'topType': 24,
  'accessoriesType': 0,
  'hairColor': 1,
  'facialHairType': 0,
  'facialHairColor': 1,
  'clotheType': 4,
  'eyeType': 6,
  'eyebrowType': 10,
  'mouthType': 8,
  'skinColor': 3,
  'clotheColor': 8,
  'style': 0,
  'graphicType': 0
}

You should also update the fluttermojiProperties and defaultFluttermojiOptions in order to use background color as a part of the SVG.

These steps are needed as the above variables are define the whole structure of the fluttermoji.

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

No branches or pull requests

2 participants