mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-08 01:43:13 +00:00
20 lines
659 B
Dart
20 lines
659 B
Dart
import 'package:intl/intl.dart';
|
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
|
|
|
/// it's ui helpers use only for ui components, don't use for logic components.
|
|
|
|
class UiHelpers {
|
|
static String getDomainName(final ServerInstallationState config) =>
|
|
config.isDomainSelected ? config.serverDomain!.domainName : 'example.com';
|
|
|
|
static String formatWithPrecision(
|
|
final double value, {
|
|
final int fraction = 2,
|
|
}) {
|
|
final NumberFormat formatter = NumberFormat();
|
|
formatter.minimumFractionDigits = 0;
|
|
formatter.maximumFractionDigits = fraction;
|
|
return formatter.format(value);
|
|
}
|
|
}
|