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

Space between pokemon types on pokemon_info screen #25

Closed
JoaoLSA opened this issue Jul 31, 2020 · 2 comments
Closed

Space between pokemon types on pokemon_info screen #25

JoaoLSA opened this issue Jul 31, 2020 · 2 comments

Comments

@JoaoLSA
Copy link

JoaoLSA commented Jul 31, 2020

Hey, I'm new into flutter development and I would appreciate if I can help you with this app. I've found out that there is no space between pokemon types but, I don't know a nice way to fix it.
Screenshot_20200730-153033

@hungps
Copy link
Owner

hungps commented Aug 1, 2020

Hi @JoaoLSA,
Thanks for your contribution. I recognized it too, and I added some spaces between them in #15. But if you want to know how to fix it by yourself, take a look at this file: /lib/screens/pokemon_info/widgets/info.dart

In _buildPokemonTypes method you can find this block of code:

            Row(
              children: pokemon.types
                  .map((type) => Hero(tag: type, child: PokemonType(type, large: true)))
                  .toList(),
            ),

This is the code to render all types of pokemon. To add space between them, you can wrap each card with Padding, or simply use the expand and take method like this to add a SizeBox between each card:

            Row(
              children: pokemon.types
                  .map((type) => Hero(tag: type, child: PokemonType(type, large: true)))
                  .expand((item) => [item, SizedBox(width: 6)])
                  .take(pokemon.types.length * 2 - 1)
                  .toList(),
            ),

@JoaoLSA
Copy link
Author

JoaoLSA commented Aug 2, 2020

Thanks a lot @scitbiz I couldn't figure out how to make that.

@JoaoLSA JoaoLSA closed this as completed Aug 2, 2020
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