2023-11-19 19:51:36 +00:00
|
|
|
import 'package:intl/intl.dart';
|
2022-05-17 13:31:34 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
2021-03-26 13:38:39 +00:00
|
|
|
|
2021-12-06 18:31:19 +00:00
|
|
|
/// it's ui helpers use only for ui components, don't use for logic components.
|
2021-03-26 13:38:39 +00:00
|
|
|
|
|
|
|
class UiHelpers {
|
2022-06-05 19:36:32 +00:00
|
|
|
static String getDomainName(final ServerInstallationState config) =>
|
2022-07-22 16:22:10 +00:00
|
|
|
config.isDomainSelected ? config.serverDomain!.domainName : 'example.com';
|
2023-11-19 19:51:36 +00:00
|
|
|
|
|
|
|
static String formatWithPrecision(
|
|
|
|
final double value, {
|
|
|
|
final int fraction = 2,
|
|
|
|
}) {
|
|
|
|
final NumberFormat formatter = NumberFormat();
|
|
|
|
formatter.minimumFractionDigits = 0;
|
|
|
|
formatter.maximumFractionDigits = fraction;
|
|
|
|
return formatter.format(value);
|
|
|
|
}
|
2021-03-26 13:38:39 +00:00
|
|
|
}
|