FaucetHub/lib/Backend/helpers.dart

57 lines
1.3 KiB
Dart

import 'package:crypto_font_icons/crypto_font_icons.dart';
import 'package:faucethub/Backend/DebugHelper.dart';
import 'package:faucethub/Backend/hoarder.dart';
import 'package:flutter/material.dart';
class Helpers{
static IconData GetIconForCrypto(String val){
switch(val){
case "BTC":
return CryptoFontIcons.BTC;
break;
case "ETH":
return CryptoFontIcons.ETH;
break;
case "XRP":
return CryptoFontIcons.XRP;
break;
case "DOGE":
return CryptoFontIcons.DOGE;
break;
case "LTC":
return CryptoFontIcons.LTC;
break;
}
return CryptoFontIcons.BTC;
}
static String GetIconForGame(String name){
Hoarder.GamesJson.forEach((element) {
if(element['name'] == name){
return element['thumbnail'];
}
});
return "";
}
static dynamic GetGameFromCode(String code){
for (var value in Hoarder.GamesJson) {
Debug.Log(value);
if(code == value['code']){
return value;
}
}
}
static dynamic GetGameFromID(int id){
for (var value in Hoarder.GamesJson) {
Debug.Log(value);
if(id == value['id']){
return value;
}
}
}
}