diff --git a/app-shared/engine b/app-shared/engine index 0545f8705..b8800d88b 160000 --- a/app-shared/engine +++ b/app-shared/engine @@ -1 +1 @@ -Subproject commit 0545f8705df301877d787107bac1a6e9fc9ee1ad +Subproject commit b8800d88be4866db1b15f8b954ab2573bba9960f diff --git a/app-shared/flutter b/app-shared/flutter index d211f4286..80c2e8497 160000 --- a/app-shared/flutter +++ b/app-shared/flutter @@ -1 +1 @@ -Subproject commit d211f42860350d914a5ad8102f9ec32764dc6d06 +Subproject commit 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 diff --git a/gui-orchid/lib/api/orchid_eth/token_type.dart b/gui-orchid/lib/api/orchid_eth/token_type.dart index b2dfeb150..3f05f74dc 100644 --- a/gui-orchid/lib/api/orchid_eth/token_type.dart +++ b/gui-orchid/lib/api/orchid_eth/token_type.dart @@ -4,7 +4,8 @@ import 'package:flutter_svg/svg.dart'; import 'package:orchid/api/pricing/orchid_pricing.dart'; import '../orchid_crypto.dart'; import 'chains.dart'; -import 'package:orchid/util/format_currency.dart' as units; +import 'package:orchid/util/format_decimal.dart' as units; +import 'package:decimal/decimal.dart'; // Token type // Note: Unfortunately Dart does not have a polyomorphic 'this' type so the @@ -47,7 +48,8 @@ class TokenType { required this.iconPath, }); - // Return 1eN where N is the decimal count. + // Return 1eN where N is the 'decimals' value. + // (Note that Dart int can handle up to 2^53-1 on JS and 2^64-1 elsewhere.) int get multiplier { return Math.pow(10, this.decimals).toInt(); } @@ -72,6 +74,11 @@ class TokenType { return fromInt(BigInt.from(val * this.multiplier)); } + // From a number representing the nominal token denomination, e.g. 1.0 OXT + Token fromDecimal(Decimal val) { + return fromInt((val * Decimal.fromInt(this.multiplier)).toBigInt()); + } + @override bool operator ==(Object other) => identical(this, other) || @@ -97,10 +104,14 @@ class Token { Token(this.type, this.intValue); // The float value in nominal units (e.g. ETH, OXT) - double get floatValue { + double get doubleValue { return intValue.toDouble() / type.multiplier; } + Decimal get decimalValue { + return Decimal.fromBigInt(intValue).shift(-type.decimals); + } + /// No token symbol String toFixedLocalized({ required Locale locale, @@ -109,8 +120,8 @@ class Token { int? minPrecision, bool showPrecisionIndicator = false, }) { - return units.formatCurrency( - floatValue, + return units.formatDecimal( + decimalValue, locale: locale, minPrecision: minPrecision, maxPrecision: maxPrecision, @@ -128,7 +139,8 @@ class Token { int? minPrecision, bool showPrecisionIndicator = false, }) { - return units.formatCurrency(floatValue, + print("XXX: format decimal value: $decimalValue"); + return units.formatDecimal(decimalValue, locale: locale, precision: precision, minPrecision: minPrecision, @@ -260,7 +272,7 @@ class Token { @override String toString() { - return 'Token{type: ${type.symbol}, floatValue: $floatValue}'; + return 'Token{type: ${type.symbol}, doubleValue: $doubleValue}'; } } diff --git a/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart b/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart index 320b50377..c65dbc084 100644 --- a/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart +++ b/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart @@ -34,16 +34,16 @@ class MarketConditionsV0 implements MarketConditions { // log("eth v0: Fetch market conditions"); // TODO: Add refresh option var costToRedeem = await getCostToRedeemTicketV0(); - var limitedByBalance = balance.floatValue <= (escrow / 2.0).floatValue; + var limitedByBalance = balance.doubleValue <= (escrow / 2.0).doubleValue; Token maxFaceValue = LotteryPot.maxTicketFaceValueFor(balance, escrow); // value received as a fraction of ticket face value - double efficiency = maxFaceValue.floatValue == 0 + double efficiency = maxFaceValue.doubleValue == 0 ? 0 : max( 0, - (maxFaceValue - costToRedeem.oxtCostToRedeem).floatValue / - maxFaceValue.floatValue) + (maxFaceValue - costToRedeem.oxtCostToRedeem).doubleValue / + maxFaceValue.doubleValue) .toDouble(); return new MarketConditionsV0( diff --git a/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart b/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart index 56dec27e2..55a6d510c 100644 --- a/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart +++ b/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart @@ -32,16 +32,16 @@ class MarketConditionsV1 implements MarketConditions { // Infer the chain from the balance token type. Chain chain = balance.type.chain; var costToRedeem = await getCostToRedeemTicket(chain, refresh: refresh); - var limitedByBalance = balance.floatValue <= (escrow / 2.0).floatValue; + var limitedByBalance = balance.doubleValue <= (escrow / 2.0).doubleValue; var maxFaceValue = LotteryPot.maxTicketFaceValueFor(balance, escrow); // value received as a fraction of ticket face value - double efficiency = maxFaceValue.floatValue == 0 + double efficiency = maxFaceValue.doubleValue == 0 ? 0 : max( 0, - (maxFaceValue - costToRedeem).floatValue / - maxFaceValue.floatValue) + (maxFaceValue - costToRedeem).doubleValue / + maxFaceValue.doubleValue) .toDouble(); //log("market conditions for: $balance, $escrow, costToRedeem = $costToRedeem, maxFaceValue=$maxFaceValue"); diff --git a/gui-orchid/lib/api/pricing/orchid_pricing.dart b/gui-orchid/lib/api/pricing/orchid_pricing.dart index 9fdc8fc77..c7b876d7c 100644 --- a/gui-orchid/lib/api/pricing/orchid_pricing.dart +++ b/gui-orchid/lib/api/pricing/orchid_pricing.dart @@ -20,13 +20,13 @@ class OrchidPricing { /// The USD value of the token quantity. Future tokenToUSD(Token token) async { - return USD(token.floatValue * await tokenToUsdRate(token.type)); + return USD(token.doubleValue * await tokenToUsdRate(token.type)); } /// Convert value of from token to equivalant USD value in 'to' token type. Future tokenToToken(Token fromToken, TokenType toType) async { return toType.fromDouble( - fromToken.floatValue * await tokenToTokenRate(fromToken.type, toType)); + fromToken.doubleValue * await tokenToTokenRate(fromToken.type, toType)); } /// (toType / fromType): The conversion rate from fromType to toType diff --git a/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart b/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart index ed93b8604..55b3a2a44 100644 --- a/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart +++ b/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart @@ -54,7 +54,7 @@ class PricingV0 { if (oxt == null) { return null; } - return USD(oxt.floatValue * oxtPriceUSD); + return USD(oxt.doubleValue * oxtPriceUSD); } OXT? toOXT(USD? usd) { diff --git a/gui-orchid/lib/api/pricing/usd.dart b/gui-orchid/lib/api/pricing/usd.dart index 031ae8b5a..51d79c8a1 100644 --- a/gui-orchid/lib/api/pricing/usd.dart +++ b/gui-orchid/lib/api/pricing/usd.dart @@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart'; import 'package:orchid/api/orchid_eth/token_type.dart'; import 'package:orchid/api/orchid_eth/tokens.dart'; import 'package:orchid/util/localization.dart'; -import '../../util/format_currency.dart'; +import '../../util/format_decimal.dart'; class USD extends ScalarValue { static const zero = USD(0.0); @@ -50,7 +50,7 @@ class USD extends ScalarValue { USD? price, bool showSuffix = true, }) { - return ((price ?? USD.zero) * (tokenAmount ?? Tokens.TOK.zero).floatValue) + return ((price ?? USD.zero) * (tokenAmount ?? Tokens.TOK.zero).doubleValue) .formatCurrency( locale: context.locale, precision: 2, @@ -59,7 +59,7 @@ class USD extends ScalarValue { } } -final _formatCurrency = formatCurrency; +final _formatCurrency = formatDouble; class ScalarValue { final T value; diff --git a/gui-orchid/lib/common/app_buttons_deprecated.dart b/gui-orchid/lib/common/app_buttons_deprecated.dart index 29de3b47a..402662715 100644 --- a/gui-orchid/lib/common/app_buttons_deprecated.dart +++ b/gui-orchid/lib/common/app_buttons_deprecated.dart @@ -19,7 +19,7 @@ class FlatButtonDeprecated extends StatelessWidget { @override Widget build(BuildContext context) { final ButtonStyle flatButtonStyle = TextButton.styleFrom( - primary: Colors.black87, + foregroundColor: Colors.black87, minimumSize: Size(88, 36), padding: padding ?? EdgeInsets.symmetric(horizontal: 16.0), shape: shape ?? @@ -61,15 +61,14 @@ class RaisedButtonDeprecated extends StatelessWidget { @override Widget build(BuildContext context) { final ButtonStyle raisedButtonStyle = ElevatedButton.styleFrom( - onPrimary: Colors.black87, - primary: Colors.grey[300], + foregroundColor: Colors.black87, minimumSize: Size(88, 36), padding: padding ?? EdgeInsets.symmetric(horizontal: 16), shape: shape ?? const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(2)), ), - backgroundColor: color, + backgroundColor: color ?? Colors.grey[300], elevation: elevation, tapTargetSize: materialTapTargetSize, disabledBackgroundColor: disabledColor, diff --git a/gui-orchid/lib/orchid/account/account_card.dart b/gui-orchid/lib/orchid/account/account_card.dart index 53c385be9..f77b60375 100644 --- a/gui-orchid/lib/orchid/account/account_card.dart +++ b/gui-orchid/lib/orchid/account/account_card.dart @@ -1,3 +1,4 @@ +import 'package:orchid/api/orchid_platform.dart'; import 'package:orchid/orchid/orchid.dart'; import 'package:orchid/api/orchid_crypto.dart'; import 'package:orchid/api/orchid_eth/tokens.dart'; @@ -15,7 +16,7 @@ import 'package:orchid/orchid/orchid_circular_identicon.dart'; import 'package:orchid/orchid/orchid_circular_progress.dart'; import 'package:orchid/orchid/orchid_gradients.dart'; import 'package:orchid/util/timed_builder.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/api/pricing/usd.dart'; import '../orchid_panel.dart'; import '../../api/orchid_eth/orchid_account_detail.dart'; @@ -360,7 +361,7 @@ class _AccountCardState extends State String? _balanceText() { return widget.accountDetail == null - ? formatCurrency(0.0, locale: context.locale, precision: 2) + ? formatDouble(0.0, locale: context.locale, precision: 2) : (pot?.balance.formatCurrency(locale: context.locale, precision: 2)); } @@ -505,15 +506,32 @@ class _AccountCardState extends State // display token value and symbol on a row with usd price in a row below Widget _buildTokenValueTextRow({Token? value, USD? price, Color? textColor}) { - final valueText = ((value ?? (tokenType ?? Tokens.TOK).zero).formatCurrency( + final valueOrZero = value ?? (tokenType ?? Tokens.TOK).zero; + + final valueText = valueOrZero.formatCurrency( locale: context.locale, minPrecision: 1, - maxPrecision: 5, + maxPrecision: OrchidPlatform.isWeb ? 18 : 4, showPrecisionIndicator: true, showSuffix: false, - )); - final valueWidget = - Text(valueText).extra_large.withColor(textColor ?? Colors.white); + ); + + final fullValueText = valueOrZero.formatCurrency( + locale: context.locale, + minPrecision: 1, + maxPrecision: (tokenType ?? Tokens.TOK).decimals, + showSuffix: false, + ); + + final style = + OrchidText.extra_large.copyWith(color: textColor ?? Colors.white); + final valueWidget = TapToCopyText( + padding: EdgeInsets.zero, + fullValueText, + displayText: valueText, + style: style, + ); + return TokenValueWidgetRow( context: context, child: valueWidget, diff --git a/gui-orchid/lib/orchid/account/market_stats_dialog.dart b/gui-orchid/lib/orchid/account/market_stats_dialog.dart index 2112ebd29..f1d15312b 100644 --- a/gui-orchid/lib/orchid/account/market_stats_dialog.dart +++ b/gui-orchid/lib/orchid/account/market_stats_dialog.dart @@ -6,7 +6,7 @@ import 'package:orchid/api/pricing/orchid_pricing_v0.dart'; import 'package:orchid/common/app_dialogs.dart'; import 'package:orchid/common/link_text.dart'; import 'package:orchid/orchid/orchid.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; class MarketStatsDialog { static Future show({ @@ -29,9 +29,9 @@ class MarketStatsDialog { if (pricing == null) { return; } - var ethPriceText = formatCurrency(1.0 / pricing.ethPriceUSD, + var ethPriceText = formatDouble(1.0 / pricing.ethPriceUSD, locale: context.locale, suffix: 'USD'); - var oxtPriceText = formatCurrency(1.0 / pricing.oxtPriceUSD, + var oxtPriceText = formatDouble(1.0 / pricing.oxtPriceUSD, locale: context.locale, suffix: 'USD'); tokenPrices = [ Text(s.ethPrice + " " + ethPriceText).body2, @@ -41,7 +41,7 @@ class MarketStatsDialog { var tokenType = account.chain.nativeCurrency; var tokenPrice = await OrchidPricing().tokenToUsdRate(tokenType); var priceText = - formatCurrency(tokenPrice, locale: context.locale, suffix: 'USD'); + formatDouble(tokenPrice, locale: context.locale, suffix: 'USD'); tokenPrices = [ Text(tokenType.symbol + ' ' + s.price + ': ' + priceText).body2, ]; @@ -49,7 +49,7 @@ class MarketStatsDialog { // Show gas prices as "GWEI" regardless of token type. var gasPriceGwei = gasPrice.multiplyDouble(1e9); - var gasPriceText = formatCurrency(gasPriceGwei.floatValue, + var gasPriceText = formatDouble(gasPriceGwei.doubleValue, locale: context.locale, suffix: 'GWEI'); String maxFaceValueText = @@ -57,8 +57,8 @@ class MarketStatsDialog { String costToRedeemText = marketConditions.costToRedeem.formatCurrency(locale: context.locale); - bool ticketUnderwater = marketConditions.costToRedeem.floatValue >= - marketConditions.maxFaceValue.floatValue; + bool ticketUnderwater = marketConditions.costToRedeem.doubleValue >= + marketConditions.maxFaceValue.doubleValue; String limitedByText = marketConditions.limitedByBalance ? s.yourMaxTicketValueIsCurrentlyLimitedByYourBalance + diff --git a/gui-orchid/lib/orchid/account_chart.dart b/gui-orchid/lib/orchid/account_chart.dart index bb4ad6c94..aaba34585 100644 --- a/gui-orchid/lib/orchid/account_chart.dart +++ b/gui-orchid/lib/orchid/account_chart.dart @@ -142,16 +142,16 @@ class AccountBalanceChartTicketModel { int get availableTicketsCurrentMax { return pot.maxTicketFaceValue.lteZero() ? 0 - : (pot.balance.floatValue / pot.maxTicketFaceValue.floatValue).floor(); + : (pot.balance.doubleValue / pot.maxTicketFaceValue.doubleValue).floor(); } // The number of tickets that could be written using the max possible face value // at the time of the last high-water mark int get availableTicketsHighWatermarkMax { - return pot.maxTicketFaceValue.floatValue == 0 + return pot.maxTicketFaceValue.doubleValue == 0 ? 0 - : (_lastBalanceHighWatermark.floatValue / - pot.maxTicketFaceValue.floatValue) + : (_lastBalanceHighWatermark.doubleValue / + pot.maxTicketFaceValue.doubleValue) .floor(); } diff --git a/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart b/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart index edb32889b..287cbfad7 100644 --- a/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart +++ b/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import 'package:orchid/orchid/field/orchid_labeled_text_field.dart'; import 'package:orchid/orchid/field/value_field_controller.dart'; +/// A styled numeric decimal or integer text field. class OrchidLabeledNumericField extends StatefulWidget { final String label; final NumericValueFieldController? controller; diff --git a/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart b/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart index b2be5fcb0..b454b2a8d 100644 --- a/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart +++ b/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart @@ -1,3 +1,4 @@ +import 'package:decimal/decimal.dart'; import 'package:orchid/common/rounded_rect.dart'; import 'package:orchid/orchid/orchid.dart'; import 'package:orchid/api/orchid_eth/token_type.dart'; @@ -132,11 +133,11 @@ class TypedTokenValueFieldController extends ValueFieldController { return type!.zero; } try { - var value = double.parse( + var value = Decimal.parse( // Allow comma as decimal separator for localization text.replaceAll(',', '.'), ); - return type!.fromDouble(value); + return type!.fromDecimal(value); } catch (err) { return null; } @@ -144,6 +145,6 @@ class TypedTokenValueFieldController extends ValueFieldController { @override set value(Token? value) { - textController.text = value == null ? '' : value.floatValue.toString(); + textController.text = value == null ? '' : value.doubleValue.toString(); } } diff --git a/gui-orchid/lib/orchid/field/orchid_text_field.dart b/gui-orchid/lib/orchid/field/orchid_text_field.dart index 0d5c97da0..141f77b16 100644 --- a/gui-orchid/lib/orchid/field/orchid_text_field.dart +++ b/gui-orchid/lib/orchid/field/orchid_text_field.dart @@ -2,6 +2,8 @@ import 'package:orchid/orchid/orchid.dart'; import 'package:flutter/services.dart'; /// A styled text field with an optional custom trailing component. +/// The text field can be optionally configured as numeric (integer or decimal) with text output. +/// @see OrchidLabledNumericField for a typed numeric field. class OrchidTextField extends StatelessWidget { final String? hintText; final Widget? trailing; diff --git a/gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart b/gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart new file mode 100644 index 000000000..247a0ae2d --- /dev/null +++ b/gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart @@ -0,0 +1,82 @@ +import 'package:orchid/api/orchid_eth/tokens.dart'; +import 'package:orchid/orchid/orchid.dart'; +import 'package:orchid/orchid/test_app.dart'; +import 'orchid_labeled_token_value_field.dart'; + +// Note: This redundant import of material is required in the main dart file. +import 'package:flutter/material.dart'; + + +void main() { + runApp(TestApp(scale: 1.0, content: _Test())); +} + +class _Test extends StatefulWidget { + const _Test({Key? key}) : super(key: key); + + @override + __TestState createState() => __TestState(); +} + +class __TestState extends State<_Test> with TickerProviderStateMixin { + @override + void initState() { + super.initState(); + controller.addListener(() { + print(controller.value?.intValue); + }); + } + + static final tokenType = Tokens.OXT; + final controller = TypedTokenValueFieldController(type: tokenType); + final textFieldDefaultHeightNonDense = 48.0; + + @override + Widget build(BuildContext context) { + TextStyle defaultStyle = TextStyle( + fontWeight: FontWeight.normal, + color: Colors.white, + fontSize: 16, + height: 1.0, + ); + TextStyle baloo2Style = defaultStyle.copyWith(fontFamily: 'Baloo2', height: 0.95); + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + buildExample(defaultStyle), + pady(24), + buildExample(baloo2Style), + ], + ), + ); + } + + Widget buildExample(TextStyle textStyle) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + textStyle.fontFamily ?? "Default", + style: textStyle, + ), + pady(8), + Stack( + alignment: Alignment.center, + children: [ + SizedBox(width: 450, child: _buildTextField(textStyle)), + ], + ), + ], + ); + } + + Widget _buildTextField(TextStyle textStyle) { + return OrchidLabeledTokenValueField( + type: tokenType, + controller: controller, + label: s.balanceToDeposit1, + // labelWidth: 180, + ); + } +} diff --git a/gui-orchid/lib/orchid/orchid_action_button.dart b/gui-orchid/lib/orchid/orchid_action_button.dart index dba5b1686..0155442c5 100644 --- a/gui-orchid/lib/orchid/orchid_action_button.dart +++ b/gui-orchid/lib/orchid/orchid_action_button.dart @@ -62,7 +62,7 @@ class OrchidActionButton extends StatelessWidget { final label = Text(text, style: textStyle ?? OrchidText.button.black); final ButtonStyle buttonStyle = TextButton.styleFrom( - primary: Colors.black87, + foregroundColor: Colors.black87, minimumSize: Size(88, 36), padding: EdgeInsets.zero, backgroundColor: isEnabled ? null : (backgroundColor ?? Color(0xffaca3bc)), diff --git a/gui-orchid/lib/orchid/test_textfield.dart b/gui-orchid/lib/orchid/test_textfield.dart index 72b03cc70..d756adf84 100644 --- a/gui-orchid/lib/orchid/test_textfield.dart +++ b/gui-orchid/lib/orchid/test_textfield.dart @@ -2,8 +2,11 @@ import 'package:orchid/orchid/orchid.dart'; import 'package:orchid/orchid/field/orchid_text_field.dart'; import 'package:orchid/orchid/test_app.dart'; +// Note: This redundant import of material is required in the main dart file. +import 'package:flutter/material.dart'; + void main() { - runApp(TestApp(scale: 5.0, content: _Test())); + runApp(TestApp(scale: 2.0, content: _Test())); } class _Test extends StatefulWidget { diff --git a/gui-orchid/lib/pages/account_manager/account_manager_page.dart b/gui-orchid/lib/pages/account_manager/account_manager_page.dart index 8ab7d966e..08f02d450 100644 --- a/gui-orchid/lib/pages/account_manager/account_manager_page.dart +++ b/gui-orchid/lib/pages/account_manager/account_manager_page.dart @@ -179,7 +179,7 @@ class _AccountManagerPageState extends State { child: PurchaseStatus(), ), pady(8), - Divider(height: 1), + // Divider(height: 1), Expanded( child: accountsEmpty ? _buildNoAccountsEmptyState() diff --git a/gui-orchid/lib/pages/circuit/orchid_hop_page.dart b/gui-orchid/lib/pages/circuit/orchid_hop_page.dart index 22e0e8bee..2a3578818 100644 --- a/gui-orchid/lib/pages/circuit/orchid_hop_page.dart +++ b/gui-orchid/lib/pages/circuit/orchid_hop_page.dart @@ -22,7 +22,7 @@ import 'package:orchid/orchid/account/market_stats_dialog.dart'; import 'package:orchid/orchid/orchid_titled_page_base.dart'; import 'package:orchid/orchid/field/orchid_text_field.dart'; import 'package:orchid/pages/account_manager/account_manager_page.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:styled_text/styled_text.dart'; import '../../common/app_sizes.dart'; import '../../common/app_text.dart'; @@ -363,7 +363,7 @@ class _OrchidHopPageState extends State { width: 150, child: Text(s.balance + ': ' + - formatCurrency(utx.update.endBalance.floatValue, + formatDouble(utx.update.endBalance.doubleValue, locale: context.locale, suffix: 'OXT')), ), padx(8), diff --git a/gui-orchid/lib/pages/connect/connect_page.dart b/gui-orchid/lib/pages/connect/connect_page.dart index f2094b525..86c5ce89d 100644 --- a/gui-orchid/lib/pages/connect/connect_page.dart +++ b/gui-orchid/lib/pages/connect/connect_page.dart @@ -167,7 +167,7 @@ class _ConnectPageState extends State LotteryPot pot = await _selectedAccount!.getLotteryPot(); var tokenToUsd = await OrchidPricing().tokenToUsdRate(pot.balance.type); _bandwidthAvailableGB = - pot.balance.floatValue * tokenToUsd / _bandwidthPrice!.value; + pot.balance.doubleValue * tokenToUsd / _bandwidthPrice!.value; } catch (err) { _bandwidthAvailableGB = null; log("error calculating bandwidth available: $err"); diff --git a/gui-orchid/lib/pages/connect/connect_status_panel.dart b/gui-orchid/lib/pages/connect/connect_status_panel.dart index 89300ce15..8ca9f6f18 100644 --- a/gui-orchid/lib/pages/connect/connect_status_panel.dart +++ b/gui-orchid/lib/pages/connect/connect_status_panel.dart @@ -7,7 +7,7 @@ import 'package:orchid/orchid/orchid_colors.dart'; import 'package:orchid/orchid/orchid_panel.dart'; import 'package:orchid/orchid/orchid_text.dart'; import 'package:orchid/util/localization.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/api/pricing/usd.dart'; import '../app_routes.dart'; @@ -57,7 +57,7 @@ class ConnectStatusPanel extends StatelessWidget { Widget _buildUSDPanel(BuildContext context) { var price = (bandwidthPrice != null && !MockOrchidAPI.hidePrices) - ? '\$' + formatCurrency(bandwidthPrice!.value, locale: context.locale) + ? '\$' + formatDouble(bandwidthPrice!.value, locale: context.locale) : '...'; return _buildPanel( icon: SvgPicture.asset(OrchidAssetSvg.dollars_icon_path, diff --git a/gui-orchid/lib/pages/connect/manage_accounts_card.dart b/gui-orchid/lib/pages/connect/manage_accounts_card.dart index 1efb62411..d6c20a414 100644 --- a/gui-orchid/lib/pages/connect/manage_accounts_card.dart +++ b/gui-orchid/lib/pages/connect/manage_accounts_card.dart @@ -12,7 +12,7 @@ import 'package:orchid/vpn/model/circuit.dart'; import 'package:orchid/vpn/model/circuit_hop.dart'; import 'package:orchid/vpn/model/orchid_hop.dart'; import 'package:orchid/util/localization.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import '../../orchid/orchid_circular_identicon.dart'; import '../../orchid/orchid_panel.dart'; import '../../orchid/orchid_text.dart'; @@ -264,7 +264,7 @@ class _ManageAccountsCardState extends State { : signerAddress.toString(elide: true); final textWidth = signerAddress == null ? null : 120.0; final balanceText = signerAddress == null - ? formatCurrency(0.0, locale: context.locale, precision: 2) + ? formatDouble(0.0, locale: context.locale, precision: 2) : (_selectedAccount?.lotteryPot?.balance .formatCurrency(precision: 2, locale: context.locale) ?? "..."); diff --git a/gui-orchid/lib/pages/connect/welcome_panel.dart b/gui-orchid/lib/pages/connect/welcome_panel.dart index 8e727ffcc..edee4af75 100644 --- a/gui-orchid/lib/pages/connect/welcome_panel.dart +++ b/gui-orchid/lib/pages/connect/welcome_panel.dart @@ -23,7 +23,7 @@ import 'package:orchid/orchid/orchid_circular_identicon.dart'; import 'package:orchid/orchid/orchid_circular_progress.dart'; import 'package:orchid/orchid/orchid_titled_panel.dart'; import 'package:orchid/pages/purchase/purchase_page.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:styled_text/styled_text.dart'; import '../app_routes.dart'; @@ -697,21 +697,21 @@ class _WelcomePanelState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.vpnCredits).body2, - Text(formatCurrency(credits, locale: context.locale)).body2, + Text(formatDouble(credits, locale: context.locale)).body2, ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.blockchainFee).body2, - Text('+ ' + formatCurrency(fee, locale: context.locale)).body2, + Text('+ ' + formatDouble(fee, locale: context.locale)).body2, ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.promotion, style: OrchidText.body2.blueHightlight), - Text('- ' + formatCurrency(promo, locale: context.locale), + Text('- ' + formatDouble(promo, locale: context.locale), style: OrchidText.body2.blueHightlight), ], ), @@ -720,7 +720,7 @@ class _WelcomePanelState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.total.toUpperCase()).subtitle, - Text(formatCurrency(total, locale: context.locale)).subtitle, + Text(formatDouble(total, locale: context.locale)).subtitle, ], ) ], diff --git a/gui-orchid/lib/pages/help/help_overview.dart b/gui-orchid/lib/pages/help/help_overview.dart index 71e5140db..be0091184 100644 --- a/gui-orchid/lib/pages/help/help_overview.dart +++ b/gui-orchid/lib/pages/help/help_overview.dart @@ -63,7 +63,7 @@ class _HelpOverviewPageState extends State { return Html.fromElement( documentElement: doc, - onLinkTap: (url, context, attributes, element) { + onLinkTap: (url, attributes, element) { launch(url ?? '', forceSafariVC: false); }, style: { diff --git a/gui-orchid/lib/pages/purchase/purchase_page.dart b/gui-orchid/lib/pages/purchase/purchase_page.dart index 933671da0..793907a0b 100644 --- a/gui-orchid/lib/pages/purchase/purchase_page.dart +++ b/gui-orchid/lib/pages/purchase/purchase_page.dart @@ -22,7 +22,7 @@ import 'package:orchid/orchid/orchid_titled_page_base.dart'; import 'package:in_app_purchase_storekit/store_kit_wrappers.dart'; import 'package:orchid/orchid/orchid_gradients.dart'; import 'package:orchid/orchid/orchid_panel.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/api/pricing/usd.dart'; import 'package:styled_text/styled_text.dart'; import '../../common/app_sizes.dart'; @@ -187,7 +187,7 @@ class _PurchasePageState extends State { final titleStyle = OrchidText.medium_24_050; var payPerUse = s.payPerUseVpnService; var price = (_bandwidthPrice != null && !MockOrchidAPI.hidePrices) - ? "\$" + formatCurrency(_bandwidthPrice!.value, locale: context.locale) + ? "\$" + formatDouble(_bandwidthPrice!.value, locale: context.locale) : "..."; var currentAvgVPNPrice = s.averagePriceIsUSDPerGb(price); var notASub = s.notASubscriptionCreditsDontExpire; @@ -549,12 +549,12 @@ class _PurchasePageState extends State { textAlign: TextAlign.right, ), Text( - '+ ' + formatCurrency(fee, locale: context.locale), + '+ ' + formatDouble(fee, locale: context.locale), style: valueStyle, textAlign: TextAlign.right, ), Text( - '- ' + formatCurrency(promo, locale: context.locale), + '- ' + formatDouble(promo, locale: context.locale), style: valueStyle, textAlign: TextAlign.right, ), diff --git a/gui-orchid/lib/pages/side_drawer.dart b/gui-orchid/lib/pages/side_drawer.dart index ed2d9ac5f..7140b0c48 100644 --- a/gui-orchid/lib/pages/side_drawer.dart +++ b/gui-orchid/lib/pages/side_drawer.dart @@ -204,7 +204,7 @@ class SideDrawerTile extends StatelessWidget { child: Container( child: ListTile( contentPadding: EdgeInsets.only(left: 16, right: 16), - horizontalTitleGap: 0, + // horizontalTitleGap: 0, leading: Padding( padding: EdgeInsets.only(left: hoffset), child: leading, diff --git a/gui-orchid/lib/util/format_currency.dart b/gui-orchid/lib/util/format_currency.dart deleted file mode 100644 index 68f052d77..000000000 --- a/gui-orchid/lib/util/format_currency.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'dart:ui'; -import 'package:intl/intl.dart'; - -String toFixedLocalized(num value, - {int precision = 2, String ifNull = "...", required Locale locale}) { - return formatCurrency(value, - locale: locale, ifNull: ifNull, precision: precision); -} - -/// Format a currency to default precision with an optional suffix and null behavior. -String formatCurrency( - num? value, { - String? suffix, - - /// The exact number of digits, possibly zero padded, to display after the decimal. - /// If minPrecision and maxPrecision are specified this value is ignored. - /// e.g. 1.00, 1.01 - int precision = 2, - - /// If minPrecision and maxPrecision are specified the value shows the required number - /// of digits after the decimal with a minimum (zero padded) and up to the maximum provided. - /// e.g. 1.0, 1.123456789 - int? maxPrecision, - int? minPrecision, - - /// If true show ellipsis when full precision is not shown - bool showPrecisionIndicator = false, - String ifNull = "...", - required Locale locale, -}) { - if (value == null) { - return ifNull; - } - - final suffixPadded = (suffix != null ? " $suffix" : ""); - - // min/max precision - if (minPrecision != null && maxPrecision != null) { - final format = - "#0." + "0" * minPrecision + "#" * (maxPrecision - minPrecision); - - final restricted = - NumberFormat(format, locale.toLanguageTag()).format(value); - - var precisionIndicator = ''; - if (showPrecisionIndicator) { - const ellipsis = '…'; - final unrestricted = - NumberFormat("#0." + "#" * 16, locale.toLanguageTag()).format(value); - precisionIndicator = - restricted.length < unrestricted.length ? ellipsis : ''; - } - - return restricted + precisionIndicator + suffixPadded; - } - // fixed precision - else { - final format = "#0." + "0" * precision; - return NumberFormat(format, locale.toLanguageTag()).format(value) + - suffixPadded; - } -} diff --git a/gui-orchid/lib/util/format_decimal.dart b/gui-orchid/lib/util/format_decimal.dart new file mode 100644 index 000000000..7243b4e28 --- /dev/null +++ b/gui-orchid/lib/util/format_decimal.dart @@ -0,0 +1,186 @@ +import 'dart:ui'; +import 'package:decimal/decimal.dart'; +import 'package:decimal/intl.dart'; +import 'package:intl/intl.dart'; + +// Legacy-named helper method for formatting decimal with a fixed precision. +String toFixedLocalized(double value, + {int precision = 2, String ifNull = "...", required Locale locale}) { + return formatDouble(value, + locale: locale, ifNull: ifNull, precision: precision); +} + +/// Format a double to default precision with an optional suffix (units) and null behavior. +String formatDouble( + double? value, { + String? suffix, + + /// The exact number of digits, possibly zero padded, to display after the decimal. + /// If minPrecision and maxPrecision are specified this value is ignored. + /// e.g. 1.00, 1.01 + int precision = 2, + + /// If minPrecision and maxPrecision are specified the value shows the required number + /// of digits after the decimal with a minimum (zero padded) and up to the maximum provided. + /// e.g. 1.0, 1.123456789 + int? maxPrecision, + int? minPrecision, + + /// If true show ellipsis when full precision is not shown + bool showPrecisionIndicator = false, + String ifNull = "...", + required Locale locale, +}) { + if (value == null) { + return ifNull; + } + + final suffixPadded = (suffix != null ? " $suffix" : ""); + + // min/max precision + if (minPrecision != null && maxPrecision != null) { + final format = + "#0." + "0" * minPrecision + "#" * (maxPrecision - minPrecision); + + final restricted = + NumberFormat(format, locale.toLanguageTag()).format(value); + + var precisionIndicator = ''; + if (showPrecisionIndicator) { + const ellipsis = '…'; + final unrestricted = + NumberFormat("#0." + "#" * 18, locale.toLanguageTag()).format(value); + precisionIndicator = + restricted.length < unrestricted.length ? ellipsis : ''; + } + + return restricted + precisionIndicator + suffixPadded; + } + // fixed precision + else { + final format = "#0." + "0" * precision; + return NumberFormat(format, locale.toLanguageTag()).format(value) + + suffixPadded; + } +} + +// Note: This is the same logic as formatDouble but there are intl issues preventing +// Note: us from combining the two more at the moment. (see below) +/// Format a decimal to default precision with an optional suffix (units) and null behavior. +String formatDecimal( + Decimal? value, { + String? suffix, + + /// The exact number of digits, possibly zero padded, to display after the decimal. + /// If minPrecision and maxPrecision are specified this value is ignored. + /// e.g. 1.00, 1.01 + int precision = 2, + + /// If minPrecision and maxPrecision are specified the value shows the required number + /// of digits after the decimal with a minimum (zero padded) and up to the maximum provided. + /// e.g. 1.0, 1.123456789 + int? maxPrecision, + int? minPrecision, + + /// If true show ellipsis when full precision is not shown + bool showPrecisionIndicator = false, + String ifNull = "...", + required Locale locale, +}) { + if (value == null) { + return ifNull; + } + + final suffixPadded = (suffix != null ? " $suffix" : ""); + + // Force 'min' fixed digits (e.g. zeroes) after the decimal and then allow up to 'max' fractional digits total. + if (minPrecision != null && maxPrecision != null) { + final format = + "#0." + "0" * minPrecision + "#" * (maxPrecision - minPrecision); + + /// BUG: There is an issue with the decimal package intl integration. + /// "WARNING: For now (2024.05.30) intl doesn't work with " + /// "NumberFormat.maximumFractionDigits greater than 15 on web plateform and 18 otherwise." + // final restricted = DecimalFormatter(NumberFormat(format, locale.toLanguageTag())).format(value); + // Workaround: no internationalization at this stage + var restricted = value.toStringAsFixed(maxPrecision); + + // Implement the min/max manually + restricted = trimAndPadDecimal(restricted, minPrecision, maxPrecision); + print("XXX: restricted: $restricted"); + + var precisionIndicator = ''; + if (showPrecisionIndicator) { + const ellipsis = '…'; + + /// BUG: There is an issue with the decimal package intl integration. + /// "WARNING: For now (2024.05.30) intl doesn't work with " + /// "NumberFormat.maximumFractionDigits greater than 15 on web plateform and 18 otherwise." + // final unrestricted = DecimalFormatter( + // NumberFormat("#0." + "#" * 18, locale.toLanguageTag())) + // .format(value); + // Workaround: no internationalization at this stage + final unrestricted = value.toString(); + + print("XXX: unrestricted: $unrestricted"); + precisionIndicator = + restricted.length < unrestricted.length ? ellipsis : ''; + } + + // Hack some basic internationalization + // replace '.' with the locale-specific decimal separator + final decimalSeparator = + NumberFormat.decimalPattern(locale.toString()).symbols.DECIMAL_SEP; + restricted = restricted.replaceFirst('.', decimalSeparator); + + return restricted + precisionIndicator + suffixPadded; + } + // fixed precision + else { + final format = "#0." + "0" * precision; + return DecimalFormatter(NumberFormat(format, locale.toLanguageTag())) + .format(value) + + suffixPadded; + } +} + +// Temporary workaround for the lack of intl formatting support for long decimals +// in the decimal package (see above). +String trimAndPadDecimal(String value, int minPrecision, int maxPrecision) { + // Handle cases where the value is just '0' or '0.' or '0.0...' + if (value == "0" || value.replaceAll("0", "") == ".") { + value = "0"; + } + + // Ensure there's a decimal point for further processing + if (!value.contains('.')) { + value += '.'; + } + + // Split into integer and fractional parts + List parts = value.split('.'); + String integerPart = parts[0].isEmpty ? '0' : parts[0]; + String fractionalPart = parts.length > 1 ? parts[1] : ''; + + // Apply maxPrecision: truncate if necessary + if (fractionalPart.length > maxPrecision) { + fractionalPart = fractionalPart.substring(0, maxPrecision); + } + + // Apply minPrecision: pad with zeros if necessary + while (fractionalPart.length < minPrecision) { + fractionalPart += '0'; + } + + // Remove trailing zeros beyond minPrecision + if (fractionalPart.length > minPrecision) { + fractionalPart = fractionalPart.replaceAll(RegExp(r'0+$'), ''); + } + + // If the fractional part is empty, return just the integer part with minPrecision zeros + if (fractionalPart.isEmpty) { + fractionalPart = '0' * minPrecision; + } + + return '$integerPart.$fractionalPart'; +} diff --git a/gui-orchid/pubspec.lock b/gui-orchid/pubspec.lock index cddf4b6d4..ceef1d2fb 100644 --- a/gui-orchid/pubspec.lock +++ b/gui-orchid/pubspec.lock @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -89,6 +89,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" dotted_border: dependency: "direct main" description: @@ -162,18 +170,18 @@ packages: dependency: "direct main" description: name: flutter_html - sha256: "342c7908f0a67bcec62b6e0f7cf23e23bafe7f64693665dd35be98d5e783bdfd" + sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" url: "https://pub.dev" source: hosted - version: "3.0.0-alpha.6" + version: "3.0.0-beta.2" flutter_js: dependency: "direct main" description: name: flutter_js - sha256: "5bf5db354fe78fe24cb90a5fa6b4423d38712440c88e3445c3dc88bc134c452f" + sha256: d19cde4bad2f7c301ff5f69d7b3452ff91f2ca89d153569dd03e544579d8610d url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.8.1" flutter_localizations: dependency: "direct main" description: flutter @@ -209,10 +217,10 @@ packages: dependency: transitive description: name: html - sha256: d9793e10dbe0e6c364f4c59bf3e01fb33a9b2a674bc7a1081693dba0614b6269 + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" url: "https://pub.dev" source: hosted - version: "0.15.1" + version: "0.15.4" http: dependency: "direct main" description: @@ -257,10 +265,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" jdenticon_dart: dependency: "direct main" description: @@ -293,39 +301,70 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + list_counter: + dependency: transitive + description: + name: list_counter + sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 + url: "https://pub.dev" + source: hosted + version: "1.0.2" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" mobile_scanner: dependency: "direct main" description: - path: "." - ref: "9e4e9a167980f8413c1d8860873e582d0747edd9" - resolved-ref: "9e4e9a167980f8413c1d8860873e582d0747edd9" - url: "https://github.com/juliansteenbakker/mobile_scanner.git" - source: git - version: "3.0.0-beta.4" + name: mobile_scanner + sha256: "6ac2913ad98c83f558d2c8a55bc8f511bdcf28b86639701c04b04c16da1e9ee1" + url: "https://pub.dev" + source: hosted + version: "5.2.1" nested: dependency: transitive description: @@ -334,22 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" - numerus: - dependency: transitive - description: - name: numerus - sha256: "436759d84f233b40107d0cc31cfa92d24e0960afeb2e506be70926d4cddffd9e" - url: "https://pub.dev" - source: hosted - version: "2.0.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -426,10 +457,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.8" pointycastle: dependency: "direct main" description: @@ -470,6 +501,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -490,66 +529,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: eb7cfb572af1ccc8b81f66bfd525ae0e8d196574874105b5c27db64bef9f155a + sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" url: "https://pub.dev" source: hosted - version: "2.0.12" + version: "2.3.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8e251f3c986002b65fed6396bce81f379fb63c27317d49743cf289fd0fd1ab97" + sha256: a7e8467e9181cef109f601e3f65765685786c1a738a83d7fbbde377589c0d974 url: "https://pub.dev" source: hosted - version: "2.0.14" - shared_preferences_ios: + version: "2.3.1" + shared_preferences_foundation: dependency: transitive description: - name: shared_preferences_ios - sha256: "585a14cefec7da8c9c2fb8cd283a3bb726b4155c0952afe6a0caaa7b2272de34" + name: shared_preferences_foundation + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.5.2" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: fbc3cd6826896b66a5f576b025e4f344f780c84ea7f8203097a353370607a2c8 + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.1.2" - shared_preferences_macos: - dependency: transitive - description: - name: shared_preferences_macos - sha256: fbb94bf296576f49be37a1496d5951796211a8db0aa22cc0d68c46440dad808c - url: "https://pub.dev" - source: hosted - version: "2.0.4" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3 + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958 + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "07c274c2115d4d5e4280622abb09f0980e2c5b1fcdc98ae9f59a3bad5bfc1f26" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -583,18 +614,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -615,10 +646,10 @@ packages: dependency: "direct main" description: name: styled_text - sha256: f72928d1ebe8cb149e3b34a689cb1ddca696b808187cf40ac3a0bd183dff379c + sha256: fd624172cf629751b4f171dd0ecf9acf02a06df3f8a81bb56c0caa4f1df706c3 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "8.1.0" sync_http: dependency: transitive description: @@ -647,10 +678,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -723,6 +754,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + url: "https://pub.dev" + source: hosted + version: "14.2.4" wallet: dependency: transitive description: @@ -735,10 +774,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.0" web3dart: dependency: "direct main" description: @@ -787,5 +826,5 @@ packages: source: hosted version: "1.0.0" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/gui-orchid/pubspec.yaml b/gui-orchid/pubspec.yaml index 708477e33..47993ae30 100644 --- a/gui-orchid/pubspec.yaml +++ b/gui-orchid/pubspec.yaml @@ -20,10 +20,10 @@ dependencies: dotted_border: 2.0.0+2 email_validator: 2.0.1 fixnum: 1.1.0 - flutter_js: 0.8.0 + flutter_js: 0.8.1 flutter: sdk: flutter - flutter_html: 3.0.0-alpha.6 + flutter_html: 3.0.0-beta.2 flutter_localizations: sdk: flutter #flutter_secure_storage: 3.3.5 # XXX: macOS @@ -32,23 +32,25 @@ dependencies: http: 1.1.0 in_app_purchase_storekit: 0.3.5+2 in_app_purchase_android: 0.2.3+7 - intl: 0.18.1 + intl: 0.19.0 jdenticon_dart: 2.0.0 + decimal: 3.0.2 # Tracking this issue which has been merged but is not yet in a tagged release. # https://github.com/juliansteenbakker/mobile_scanner/issues/241 - mobile_scanner: - git: - url: https://github.com/juliansteenbakker/mobile_scanner.git - ref: 9e4e9a167980f8413c1d8860873e582d0747edd9 + # mobile_scanner: + # git: + # url: https://github.com/juliansteenbakker/mobile_scanner.git + # ref: 9e4e9a167980f8413c1d8860873e582d0747edd9 + mobile_scanner: 5.2.1 percent_indicator: 3.0.1 pointycastle: 3.7.3 provider: 5.0.0 qr_flutter: 4.0.0 rxdart: 0.27.7 - shared_preferences: 2.0.12 - styled_text: 7.0.0 + shared_preferences: 2.3.2 + styled_text: 8.1.0 sqflite: 2.0.0+3 url_launcher: 6.0.3 uuid: 3.0.7 diff --git a/gui-orchid/test/utils_test.dart b/gui-orchid/test/utils_test.dart index 96a509f24..a7981e290 100644 --- a/gui-orchid/test/utils_test.dart +++ b/gui-orchid/test/utils_test.dart @@ -7,6 +7,7 @@ import 'package:orchid/api/orchid_crypto.dart'; import 'package:orchid/api/orchid_eth/chains.dart'; import 'package:orchid/api/orchid_eth/token_type.dart'; import 'package:orchid/api/orchid_eth/tokens.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/vpn/purchase/orchid_pac_transaction.dart'; import 'package:orchid/util/cacheable.dart'; import 'package:orchid/util/json.dart'; @@ -200,6 +201,18 @@ void main() { print("bar = " +eval.toString()); }); + test('decimal format util test 1', () async { + TestWidgetsFlutterBinding.ensureInitialized(); + expect(trimAndPadDecimal("0", 2, 8), equals("0.00")); + expect(trimAndPadDecimal(".0", 2, 8), equals("0.00")); + expect(trimAndPadDecimal("0.000000000000000000", 2, 8), equals("0.00")); + expect(trimAndPadDecimal("0.000000123000000000", 2, 8), equals("0.00000012")); + expect(trimAndPadDecimal("1.123456789", 2, 5), equals("1.12345")); + expect(trimAndPadDecimal("1.1", 2, 5), equals("1.10")); + expect(trimAndPadDecimal("1.0", 2, 5), equals("1.00")); + print("passed"); + }); + // }); } diff --git a/modules b/modules index 36568cd9f..fe3ce3733 100755 --- a/modules +++ b/modules @@ -14,7 +14,7 @@ tag lib-shared/boost 'boost-[0-9.]*' tag min-openssl/openssl 'OpenSSL_[0-9_]*[a-z]' tag lib-shared/sqlite 'version-[0-9.]*' -head[app-shared/flutter]=3.13.9 +head[app-shared/flutter]=3.24.0 head[app-shared/engine]=$(cat app-shared/flutter/bin/internal/engine.version) head[min-v8/v8]=$(sed -e '/url = "https:\/\/github.com\/v8\/v8\//!d;s/^.*\///;s/\.tar\.gz",$//' srv-worker/workerd/WORKSPACE) diff --git a/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart b/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart index ffd4f89e1..622da47ec 100644 --- a/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart +++ b/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart @@ -102,7 +102,7 @@ class DappWalletInfoPanel extends StatelessWidget { final priceStyle = OrchidText.medium_14.newPurpleBright; final tokenType = balance.type; return TapToCopyText( - balance.floatValue.toString(), + balance.decimalValue.toString(), style: OrchidText.title.copyWith(height: 1.8), padding: EdgeInsets.zero, displayWidget: Column( @@ -134,7 +134,7 @@ class DappWalletInfoPanel extends StatelessWidget { TokenPriceBuilder( tokenType: tokenType, builder: (USD? tokenPrice) { - final usdText = ((tokenPrice ?? USD.zero) * balance.floatValue) + final usdText = ((tokenPrice ?? USD.zero) * balance.doubleValue) .formatCurrency(locale: context.locale); return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart b/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart index 24cbe76f9..e71c6913a 100644 --- a/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart +++ b/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart @@ -19,7 +19,7 @@ class MoveFundsPaneV0 extends StatefulWidget { final bool enabled; const MoveFundsPaneV0({ - Key? key, + Key? key, required this.context, required this.pot, required this.signer, diff --git a/web-ethereum/account_dapp/pubspec.lock b/web-ethereum/account_dapp/pubspec.lock index 32c290a03..4dd07e259 100644 --- a/web-ethereum/account_dapp/pubspec.lock +++ b/web-ethereum/account_dapp/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -161,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" dotted_border: dependency: "direct main" description: @@ -288,10 +296,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" jdenticon_dart: dependency: "direct main" description: @@ -324,6 +332,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -344,26 +376,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" package_config: dependency: transitive description: @@ -376,10 +408,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -508,6 +540,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -581,18 +621,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -629,10 +669,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -721,22 +761,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: + vm_service: dependency: transitive description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "1.0.2" - web: + version: "14.2.4" + watcher: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.2" web3dart: dependency: "direct main" description: @@ -786,5 +826,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/web-ethereum/account_dapp/pubspec.yaml b/web-ethereum/account_dapp/pubspec.yaml index ca69fa7a8..3a29ef8eb 100644 --- a/web-ethereum/account_dapp/pubspec.yaml +++ b/web-ethereum/account_dapp/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sdk: flutter flutter_svg: 1.0.3 font_awesome_flutter: 9.0.0 - intl: 0.18.1 + intl: 0.19.0 jdenticon_dart: 2.0.0 percent_indicator: 3.0.1 pointycastle: 3.5.0 @@ -29,6 +29,7 @@ dependencies: url_launcher: 6.1.3 uuid: 3.0.5 web3dart: 2.3.3 # Utils used in orchid_crypto + decimal: 3.0.2 #flutter_web3: 2.1.9 # Dapp ether.js and WalletConnect wrapper flutter_web3: diff --git a/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart b/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart index 760423ed6..036a4499b 100644 --- a/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart +++ b/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart @@ -173,7 +173,7 @@ class _OrchidWidgetHomeState extends State { return Container(); } if (_showPricesUSD) { - return Text((tokenPrice * token.floatValue) + return Text((tokenPrice * token.doubleValue) .formatCurrency(locale: context.locale)) .body2; } else { @@ -257,7 +257,7 @@ class _ChainModel { if (version == 0) { costToCreateAccountUSD = (await MarketConditionsV0.getPotStats( efficiency: targetEfficiency, tickets: targetTickets)) - .floatValue * + .doubleValue * tokenPriceUSD; // log('XXX: V0! tokenPrice = $tokenPriceUSD, cost = $costToCreateAccountUSD'); } diff --git a/web-ethereum/price_widget/pubspec.lock b/web-ethereum/price_widget/pubspec.lock index 5ffb67102..248ddb630 100644 --- a/web-ethereum/price_widget/pubspec.lock +++ b/web-ethereum/price_widget/pubspec.lock @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -145,6 +145,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" fake_async: dependency: transitive description: @@ -249,10 +257,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" js: dependency: transitive description: @@ -277,6 +285,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -297,26 +329,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" package_config: dependency: transitive description: @@ -329,10 +361,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -437,6 +469,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.2" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -510,18 +550,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -558,10 +598,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -650,22 +690,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: + vm_service: dependency: transitive description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "1.0.2" - web: + version: "14.2.4" + watcher: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.2" web3dart: dependency: "direct main" description: @@ -715,5 +755,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/web-ethereum/price_widget/pubspec.yaml b/web-ethereum/price_widget/pubspec.yaml index c3359f1df..d2023d627 100644 --- a/web-ethereum/price_widget/pubspec.yaml +++ b/web-ethereum/price_widget/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: flutter_lints: ^1.0.0 flutter_svg: 1.0.3 flutter_web3: 2.1.6 - intl: 0.18.1 + intl: 0.19.0 pointycastle: 3.5.0 rxdart: 0.27.7 shared_preferences: 2.0.5 @@ -23,6 +23,7 @@ dependencies: uuid: 3.0.5 url_launcher: 6.1.3 web3dart: 2.3.3 + decimal: 3.0.2 dev_dependencies: flutter_test: diff --git a/web-ethereum/stake_dapp/pubspec.lock b/web-ethereum/stake_dapp/pubspec.lock index 32c290a03..4dd07e259 100644 --- a/web-ethereum/stake_dapp/pubspec.lock +++ b/web-ethereum/stake_dapp/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -161,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" dotted_border: dependency: "direct main" description: @@ -288,10 +296,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" jdenticon_dart: dependency: "direct main" description: @@ -324,6 +332,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -344,26 +376,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" package_config: dependency: transitive description: @@ -376,10 +408,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -508,6 +540,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -581,18 +621,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -629,10 +669,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -721,22 +761,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: + vm_service: dependency: transitive description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "1.0.2" - web: + version: "14.2.4" + watcher: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.2" web3dart: dependency: "direct main" description: @@ -786,5 +826,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/web-ethereum/stake_dapp/pubspec.yaml b/web-ethereum/stake_dapp/pubspec.yaml index ca69fa7a8..7d03942d1 100644 --- a/web-ethereum/stake_dapp/pubspec.yaml +++ b/web-ethereum/stake_dapp/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sdk: flutter flutter_svg: 1.0.3 font_awesome_flutter: 9.0.0 - intl: 0.18.1 + intl: 0.19.0 jdenticon_dart: 2.0.0 percent_indicator: 3.0.1 pointycastle: 3.5.0 @@ -29,6 +29,8 @@ dependencies: url_launcher: 6.1.3 uuid: 3.0.5 web3dart: 2.3.3 # Utils used in orchid_crypto + decimal: 3.0.2 + #flutter_web3: 2.1.9 # Dapp ether.js and WalletConnect wrapper flutter_web3: