From 0175a8b89488ebdad7327ea4d62a67c06edd9f93 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Mon, 13 May 2024 13:02:39 -0500 Subject: [PATCH] refactor --- lib/pages/intro_view.dart | 6 ++++-- .../settings_views/global_settings_view/support_view.dart | 2 +- lib/pages_desktop_specific/desktop_menu.dart | 4 ++-- .../password/desktop_login_view.dart | 2 +- .../settings/settings_menu/desktop_about_view.dart | 4 ++-- lib/utilities/featured_paynyms.dart | 2 +- lib/whiteLabel.dart | 8 +++++--- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/pages/intro_view.dart b/lib/pages/intro_view.dart index ad048534c..53c4b8740 100644 --- a/lib/pages/intro_view.dart +++ b/lib/pages/intro_view.dart @@ -200,8 +200,10 @@ class AppNameText extends StatelessWidget { @override Widget build(BuildContext context) { return Text( - "{$WhiteLabel.appName}", - // TODO [prio=high]: `'appName' can't be accessed using static access.`", + WhiteLabel.appName, + // TODO [prio=high]: appName is now static due to `'appName' can't be + // accessed using static access.`", check that that doesn't cause issues + // elsewhere. textAlign: TextAlign.center, style: !isDesktop ? STextStyles.pageTitleH1(context) diff --git a/lib/pages/settings_views/global_settings_view/support_view.dart b/lib/pages/settings_views/global_settings_view/support_view.dart index 8922a7a45..247264464 100644 --- a/lib/pages/settings_views/global_settings_view/support_view.dart +++ b/lib/pages/settings_views/global_settings_view/support_view.dart @@ -89,7 +89,7 @@ class SupportView extends StatelessWidget { AboutItem( linkUrl: "https://discord.com/invite/mRPZuXx3At", label: "Discord", - buttonText: "{$WhiteLabel.appName}", + buttonText: WhiteLabel.appName, iconAsset: Assets.socials.discord, isDesktop: isDesktop, ), diff --git a/lib/pages_desktop_specific/desktop_menu.dart b/lib/pages_desktop_specific/desktop_menu.dart index b4add69d1..91bc95b1b 100644 --- a/lib/pages_desktop_specific/desktop_menu.dart +++ b/lib/pages_desktop_specific/desktop_menu.dart @@ -20,9 +20,9 @@ import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/text_styles.dart'; +import 'package:stackwallet/whiteLabel.dart'; import 'package:stackwallet/widgets/desktop/desktop_tor_status_button.dart'; import 'package:stackwallet/widgets/desktop/living_stack_icon.dart'; -import 'package:stackwallet/whiteLabel.dart'; enum DesktopMenuItemId { myStack, @@ -139,7 +139,7 @@ class _DesktopMenuState extends ConsumerState { child: SizedBox( height: 28, child: Text( - "{$WhiteLabel.appName}", + WhiteLabel.appName, style: STextStyles.desktopH2(context).copyWith( fontSize: 18, height: 23.4 / 18, diff --git a/lib/pages_desktop_specific/password/desktop_login_view.dart b/lib/pages_desktop_specific/password/desktop_login_view.dart index e785129be..b2ac42a73 100644 --- a/lib/pages_desktop_specific/password/desktop_login_view.dart +++ b/lib/pages_desktop_specific/password/desktop_login_view.dart @@ -201,7 +201,7 @@ class _DesktopLoginViewState extends ConsumerState { height: 42, ), Text( - "{$WhiteLabel.appName}", + WhiteLabel.appName, style: STextStyles.desktopH1(context), ), const SizedBox( diff --git a/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart b/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart index 2d7b8f224..3b61f24e5 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart @@ -21,12 +21,12 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/text_styles.dart'; +import 'package:stackwallet/whiteLabel.dart'; import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:stackwallet/whiteLabel.dart'; const kGithubAPI = "https://api.github.com"; const kGithubSearch = "/search/commits"; @@ -166,7 +166,7 @@ class DesktopAboutView extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - "{$WhiteLabel.appName}", + oWhiteLabel.appName, style: STextStyles.desktopH3(context), textAlign: TextAlign.start, ), diff --git a/lib/utilities/featured_paynyms.dart b/lib/utilities/featured_paynyms.dart index b7f0d77eb..e0771328f 100644 --- a/lib/utilities/featured_paynyms.dart +++ b/lib/utilities/featured_paynyms.dart @@ -18,7 +18,7 @@ abstract class FeaturedPaynyms { "PM8TJdQcNk27JpxGRtNR7Hnh8VkJk4Nf17BthLx89fM3iX3UL2YshyaiTAvKgTCVvpgsAgY1DbojkAaUd3Rcn48NEn4uUBuqkaSddgKL8TPAAEQXNuE6"; static Map get featured => { - "{$WhiteLabel.appName}": stackWallet, + WhiteLabel.appName: stackWallet, // "Samourai Wallet Dev Fund": samouraiWalletDevFund, }; } diff --git a/lib/whiteLabel.dart b/lib/whiteLabel.dart index 6cb0cb43e..0e00e0e7a 100644 --- a/lib/whiteLabel.dart +++ b/lib/whiteLabel.dart @@ -1,7 +1,9 @@ abstract class WhiteLabel { - String get appName => appNamePrefix + appNameSuffix; + static String get appName => prefix + separator + suffix; - String get appNamePrefix => "Stack"; + static String get prefix => "Stack"; - String get appNameSuffix => "Wallet"; + static String get separator => " "; + + static String get suffix => "Wallet"; }