-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor. color map for pokemon card
- Loading branch information
Showing
2 changed files
with
35 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:pokedex_tracker/util/color_extension.dart'; | ||
|
||
const Color primaryColor = Colors.red; | ||
const Color appBarTextColor = Colors.white; | ||
const Color unselectedTabColor = Color(0xFFFAD54F); | ||
const Color displayTextColor = Colors.black; | ||
const Map<String, Color> typesColor = { | ||
"Grass": Colors.greenAccent, | ||
"Water": Colors.blueAccent, | ||
"Fire": Colors.orangeAccent, | ||
"Normal": Colors.grey, | ||
"Flying": Colors.lightBlueAccent, | ||
"Bug": Colors.lightGreenAccent, | ||
"Poison": Colors.deepPurpleAccent, | ||
"Electric": Colors.amberAccent, | ||
"Fighting": Colors.brown, | ||
"Rock": Color(0xFFBD8C7A), | ||
"Ground": Color(0xFF5F1800), | ||
"Fairy": Colors.pinkAccent, | ||
"Psychic": Colors.purpleAccent, | ||
"Dark": Colors.black54, | ||
"Steel": Colors.blueGrey, | ||
"Dragon": Color(0xFF252FF9), | ||
"Ice": Colors.blue | ||
Map<String, Color> typesColor = { | ||
"Grass": '#82C274'.hexToColor(), | ||
"Water": '#74ACF5'.hexToColor(), | ||
"Fire": '#EF7374'.hexToColor(), | ||
"Normal": "#C1C2C1".hexToColor(), | ||
"Flying": '#ADD2F5'.hexToColor(), | ||
"Bug": '#B8C26A'.hexToColor(), | ||
"Poison": "#B884DD".hexToColor(), | ||
"Electric": '#FCD659'.hexToColor(), | ||
"Fighting": '#FFAC59'.hexToColor(), | ||
"Rock": '#CBC7AD'.hexToColor(), | ||
"Ground": '#B88E6F'.hexToColor(), | ||
"Fairy": '#F5A2F5'.hexToColor(), | ||
"Psychic": '#F584A8'.hexToColor(), | ||
"Dark": '#998B8C'.hexToColor(), | ||
"Steel": '#98C2D1'.hexToColor(), | ||
"Dragon": "#8D98EC".hexToColor(), | ||
"Ice": '#81DFF7'.hexToColor(), | ||
"Ghost": "#A284A2".hexToColor() | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
extension ColorExtension on String { | ||
Color hexToColor() { | ||
final buffer = StringBuffer(); | ||
|
||
if(length == 6 || length == 7) { | ||
buffer.write('ff'); | ||
} | ||
|
||
buffer.write(replaceFirst('#', '')); | ||
|
||
return Color(int.parse(buffer.toString(), radix: 16)); | ||
} | ||
} |