Frontend first draft
This commit is contained in:
38
frontend/pweb/lib/utils/currency.dart
Normal file
38
frontend/pweb/lib/utils/currency.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/models/currency.dart';
|
||||
|
||||
|
||||
String currencyCodeToSymbol(Currency currencyCode) {
|
||||
switch (currencyCode) {
|
||||
case Currency.usd:
|
||||
return '\$';
|
||||
case Currency.eur:
|
||||
return '€';
|
||||
case Currency.rub:
|
||||
return '₽';
|
||||
case Currency.usdt:
|
||||
return 'USDT';
|
||||
case Currency.usdc:
|
||||
return 'USDC';
|
||||
}
|
||||
}
|
||||
|
||||
String currencyToString(Currency currencyCode, double amount) {
|
||||
return '${amount.toStringAsFixed(2)} ${currencyCodeToSymbol(currencyCode)}';
|
||||
}
|
||||
|
||||
IconData iconForCurrencyType(Currency currencyCode) {
|
||||
switch (currencyCode) {
|
||||
case Currency.usd:
|
||||
return Icons.currency_exchange;
|
||||
case Currency.eur:
|
||||
return Icons.currency_exchange;
|
||||
case Currency.rub:
|
||||
return Icons.currency_ruble;
|
||||
case Currency.usdt:
|
||||
return Icons.currency_exchange;
|
||||
case Currency.usdc:
|
||||
return Icons.money;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user