init projet

This commit is contained in:
Guillaume Vern
2026-01-16 14:50:38 +01:00
parent 596870f278
commit 570df27bea
136 changed files with 5241 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import '../models/pokemon.dart';
// Permet de mapper un type de Pokémon avec une couleur
Color typeToColor(PokemonType type) {
Map<PokemonType, Color> typeToColor = {
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 typeToColor[type] ?? Colors.transparent;
}
// Met le nom du type de Pokémon avec une majuscule
String formatedTypeName(PokemonType type) {
String typeName = type.toString().split('.').last.replaceAll('PokemonType.', '');
return typeName[0].toUpperCase() + typeName.substring(1);
}