mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-04 12:24:47 +00:00
Added select server screen and add server screen
This commit is contained in:
parent
e1ff7a151d
commit
a97ae20631
22 changed files with 623 additions and 27 deletions
45
lib/functions/conversions.dart
Normal file
45
lib/functions/conversions.dart
Normal file
|
@ -0,0 +1,45 @@
|
|||
import 'package:intl/intl.dart';
|
||||
|
||||
bool? convertFromIntToBool(int value) {
|
||||
if (value == 1) {
|
||||
return true;
|
||||
}
|
||||
else if (value == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
int? convertFromBoolToInt(bool value) {
|
||||
if (value == true) {
|
||||
return 1;
|
||||
}
|
||||
else if (value == false) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
double formatPercentage(double value) {
|
||||
return (value * 100).truncateToDouble() / 100;
|
||||
}
|
||||
|
||||
String intFormat(int value, String locale) {
|
||||
final f = NumberFormat("#,###", locale);
|
||||
return f.format(value);
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> convertFromMapToList(Map<String, int> values) {
|
||||
List<Map<String, dynamic>> items = [];
|
||||
values.forEach((key, value) {
|
||||
items.add({
|
||||
"label": key,
|
||||
"value": value
|
||||
});
|
||||
});
|
||||
return items;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue