selfprivacy.org.app/lib/utils/ui_helpers.dart
aliaksei tratseuski dd81053f42 refactor(UI): Rewrite onboarding page
rewrote OnboardingPage:
* decomposed into separate widgets
* now content stays centered on wide screens (set so width won't expand further than 480px)
* pageController is now properly disposed
* added some more code changes to
    * main (error widget builder)
    * brand_header (centerTitle instead of empty actions list)
    * console_page (listener callback fix, used gaps instead of SizedBox'es, added keys to list items)
    * service_page (just cleaner build method)
	* removed some dead code

Co-authored-by: Aliaksei Tratseuski <aliaksei.tratseuski@gmail.com>
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/444
Co-authored-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
Co-committed-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
2024-02-08 13:59:52 +02:00

20 lines
641 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 final _formatter = NumberFormat()..minimumFractionDigits = 0;
static String formatWithPrecision(
final double value, {
final int fraction = 2,
}) {
_formatter.maximumFractionDigits = fraction;
return _formatter.format(value);
}
}