From 13ab2b8ffeceade648c14d8fc40a1527e1004fcd Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 14 Jun 2024 14:20:28 -0500 Subject: [PATCH] port String extension capitalize() from flutter_native_splash to sw exts --- lib/db/isar/main_db.dart | 2 +- lib/pages/cashfusion/cashfusion_view.dart | 2 +- lib/pages/cashfusion/fusion_rounds_selection_sheet.dart | 3 ++- lib/pages/generic/single_field_edit_view.dart | 3 ++- lib/pages/receive_view/addresses/address_tag.dart | 3 ++- lib/pages/send_view/send_view.dart | 2 +- .../wallet_view/sub_widgets/wallet_summary_info.dart | 7 ++++--- .../cashfusion/desktop_cashfusion_view.dart | 2 +- lib/services/exchange/trocador/trocador_api.dart | 9 +++++---- lib/utilities/extensions/impl/string.dart | 6 ++++++ lib/widgets/desktop/desktop_tor_status_button.dart | 3 ++- 11 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lib/db/isar/main_db.dart b/lib/db/isar/main_db.dart index 1ea6830c5..a16fb2b9a 100644 --- a/lib/db/isar/main_db.dart +++ b/lib/db/isar/main_db.dart @@ -9,7 +9,6 @@ */ import 'package:decimal/decimal.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; import 'package:isar/isar.dart'; import 'package:tuple/tuple.dart'; @@ -21,6 +20,7 @@ import '../../models/isar/models/isar_models.dart'; import '../../models/isar/ordinal.dart'; import '../../models/isar/stack_theme.dart'; import '../../utilities/amount/amount.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/stack_file_system.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/models/frost_wallet_info.dart'; diff --git a/lib/pages/cashfusion/cashfusion_view.dart b/lib/pages/cashfusion/cashfusion_view.dart index 46d8a2451..4579dbc52 100644 --- a/lib/pages/cashfusion/cashfusion_view.dart +++ b/lib/pages/cashfusion/cashfusion_view.dart @@ -12,7 +12,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -22,6 +21,7 @@ import '../../providers/global/wallets_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/text_styles.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/providers/wallet_info_provider.dart'; diff --git a/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart b/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart index 3994efaa9..72cd027dd 100644 --- a/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart +++ b/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart @@ -10,9 +10,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/constants.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/text_styles.dart'; enum FusionOption { diff --git a/lib/pages/generic/single_field_edit_view.dart b/lib/pages/generic/single_field_edit_view.dart index b02490db4..5ffb7196f 100644 --- a/lib/pages/generic/single_field_edit_view.dart +++ b/lib/pages/generic/single_field_edit_view.dart @@ -9,9 +9,10 @@ */ import 'package:flutter/material.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/constants.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; import '../../widgets/background.dart'; diff --git a/lib/pages/receive_view/addresses/address_tag.dart b/lib/pages/receive_view/addresses/address_tag.dart index 1d7ebaf5b..c6a1efcd4 100644 --- a/lib/pages/receive_view/addresses/address_tag.dart +++ b/lib/pages/receive_view/addresses/address_tag.dart @@ -9,8 +9,9 @@ */ import 'package:flutter/material.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; + import '../../../themes/stack_colors.dart'; +import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/text_styles.dart'; import '../../../widgets/rounded_container.dart'; diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 8d1f12c5d..7851c9954 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -15,7 +15,6 @@ import 'package:cw_core/monero_transaction_priority.dart'; import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:tuple/tuple.dart'; @@ -40,6 +39,7 @@ import '../../utilities/barcode_scanner_interface.dart'; import '../../utilities/clipboard_interface.dart'; import '../../utilities/constants.dart'; import '../../utilities/enums/fee_rate_type_enum.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/logger.dart'; import '../../utilities/prefs.dart'; import '../../utilities/text_styles.dart'; diff --git a/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart b/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart index 7b44e17eb..6862f878a 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart @@ -12,11 +12,9 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:flutter/material.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'wallet_balance_toggle_sheet.dart'; -import 'wallet_refresh_button.dart'; + import '../../../providers/providers.dart'; import '../../../providers/wallet/public_private_balance_state_provider.dart'; import '../../../providers/wallet/wallet_balance_toggle_state_provider.dart'; @@ -27,12 +25,15 @@ import '../../../utilities/amount/amount.dart'; import '../../../utilities/amount/amount_formatter.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/enums/wallet_balance_toggle_state.dart'; +import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/text_styles.dart'; import '../../../wallets/crypto_currency/coins/banano.dart'; import '../../../wallets/crypto_currency/coins/firo.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../wallets/wallet/impl/banano_wallet.dart'; import '../../../widgets/conditional_parent.dart'; +import 'wallet_balance_toggle_sheet.dart'; +import 'wallet_refresh_button.dart'; class WalletSummaryInfo extends ConsumerWidget { const WalletSummaryInfo({ diff --git a/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart b/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart index d35da1a31..e12e72e11 100644 --- a/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart +++ b/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart @@ -14,7 +14,6 @@ import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -25,6 +24,7 @@ import '../../providers/global/wallets_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/text_styles.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/providers/wallet_info_provider.dart'; diff --git a/lib/services/exchange/trocador/trocador_api.dart b/lib/services/exchange/trocador/trocador_api.dart index 7ef259186..9b497a685 100644 --- a/lib/services/exchange/trocador/trocador_api.dart +++ b/lib/services/exchange/trocador/trocador_api.dart @@ -11,17 +11,18 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; + import '../../../exceptions/exchange/exchange_exception.dart'; import '../../../networking/http.dart'; +import '../../../utilities/extensions/extensions.dart'; +import '../../../utilities/logger.dart'; +import '../../../utilities/prefs.dart'; +import '../../tor_service.dart'; import '../exchange_response.dart'; import 'response_objects/trocador_coin.dart'; import 'response_objects/trocador_rate.dart'; import 'response_objects/trocador_trade.dart'; import 'response_objects/trocador_trade_new.dart'; -import '../../tor_service.dart'; -import '../../../utilities/logger.dart'; -import '../../../utilities/prefs.dart'; const kTrocadorApiKey = "8rFqf7QLxX1mUBiNPEMaLUpV2biz6n"; const kTrocadorRefCode = "9eHm9BkQfS"; diff --git a/lib/utilities/extensions/impl/string.dart b/lib/utilities/extensions/impl/string.dart index 6a25f23b6..9ed425611 100644 --- a/lib/utilities/extensions/impl/string.dart +++ b/lib/utilities/extensions/impl/string.dart @@ -9,6 +9,7 @@ */ import 'dart:convert'; +import 'dart:core'; import 'dart:typed_data'; import 'package:dart_bs58/dart_bs58.dart'; @@ -38,4 +39,9 @@ extension StringExtensions on String { .reversed .map((e) => e.toRadixString(16).padLeft(2, '0')) .join(); + + /// Capitalize the first letter of a string. + String capitalize() { + return isEmpty ? this : "${this[0].toUpperCase()}${substring(1)}"; + } } diff --git a/lib/widgets/desktop/desktop_tor_status_button.dart b/lib/widgets/desktop/desktop_tor_status_button.dart index 45d82d9ab..f4df42a64 100644 --- a/lib/widgets/desktop/desktop_tor_status_button.dart +++ b/lib/widgets/desktop/desktop_tor_status_button.dart @@ -2,15 +2,16 @@ import 'dart:async'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../pages_desktop_specific/desktop_menu_item.dart'; import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart'; import '../../services/event_bus/global_event_bus.dart'; import '../../services/tor_service.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; +import '../../utilities/extensions/extensions.dart'; import '../../utilities/text_styles.dart'; class DesktopTorStatusButton extends ConsumerStatefulWidget {