feat(presentation): add type colors helper
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
8ca6405bc0
commit
b1f67d3daa
35
lib/presentation/theme/type_colors.dart
Normal file
35
lib/presentation/theme/type_colors.dart
Normal file
@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../domain/entities/pokemon.dart';
|
||||
|
||||
/// Couleur d'affichage associée à un type de Pokémon.
|
||||
Color typeToColor(PokemonType type) {
|
||||
final Map<PokemonType, Color> map = {
|
||||
PokemonType.normal: Colors.white,
|
||||
PokemonType.fire: Colors.red,
|
||||
PokemonType.water: Colors.blue,
|
||||
PokemonType.electric: Colors.yellow,
|
||||
PokemonType.grass: Colors.green,
|
||||
PokemonType.ice: Colors.cyan,
|
||||
PokemonType.fighting: Colors.orange,
|
||||
PokemonType.poison: Colors.purple,
|
||||
PokemonType.ground: Colors.brown,
|
||||
PokemonType.flying: Colors.indigo,
|
||||
PokemonType.psychic: Colors.pink,
|
||||
PokemonType.bug: Colors.lightGreen,
|
||||
PokemonType.rock: Colors.grey,
|
||||
PokemonType.ghost: Colors.indigo,
|
||||
PokemonType.dragon: Colors.indigo,
|
||||
PokemonType.dark: Colors.black45,
|
||||
PokemonType.steel: Colors.grey.shade600,
|
||||
PokemonType.fairy: Colors.pinkAccent,
|
||||
PokemonType.unknown: Colors.transparent,
|
||||
PokemonType.shadow: Colors.transparent,
|
||||
};
|
||||
return map[type] ?? Colors.transparent;
|
||||
}
|
||||
|
||||
/// Nom du type avec une majuscule initiale.
|
||||
String formatedTypeName(PokemonType type) {
|
||||
final typeName = type.name;
|
||||
return typeName[0].toUpperCase() + typeName.substring(1);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user