diff --git a/lib/pages/buy_view/buy_form.dart b/lib/pages/buy_view/buy_form.dart index 92adfb011..168ee1d9f 100644 --- a/lib/pages/buy_view/buy_form.dart +++ b/lib/pages/buy_view/buy_form.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:intl/intl.dart'; import 'package:stackwallet/models/buy/response_objects/crypto.dart'; import 'package:stackwallet/models/buy/response_objects/fiat.dart'; import 'package:stackwallet/models/buy/response_objects/quote.dart'; @@ -526,6 +527,10 @@ class _BuyFormState extends ConsumerState { Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); + Locale locale = Localizations.localeOf(context); + var format = NumberFormat.simpleCurrency(locale: locale.toString()); + // See https://stackoverflow.com/a/67055685 + return ConditionalParent( condition: isDesktop, builder: (child) => SizedBox( @@ -654,17 +659,20 @@ class _BuyFormState extends ConsumerState { padding: const EdgeInsets.all(12), child: Row( children: [ - RoundedContainer( - radiusMultiplier: 0.5, - padding: const EdgeInsets.symmetric( - vertical: 2, horizontal: 4), - color: Theme.of(context) - .extension()! - .highlight, - child: Text( - "\$", - style: STextStyles.itemSubtitle12(context), - ), + Text( + format.simpleCurrencySymbol( + selectedFiat?.ticker ?? "ERR".toUpperCase()), + style: STextStyles.currencyTicker(context).apply( + fontSizeFactor: (1 / + format + .simpleCurrencySymbol( + selectedFiat?.ticker ?? "ERR") + .length * // Couldn't get pow() working here + format + .simpleCurrencySymbol( + selectedFiat?.ticker ?? "ERR") + .length)), + textAlign: TextAlign.center, ), // SvgPicture.asset( // Assets.svg.iconFor( diff --git a/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart b/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart index c78df4c42..14417cdef 100644 --- a/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart +++ b/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart @@ -217,7 +217,7 @@ class _FiatSelectionViewState extends State { : Text( format.simpleCurrencySymbol( _fiats[index].ticker.toUpperCase()), - style: STextStyles.largeMedium14(context) + style: STextStyles.currencyTicker(context) .apply( fontSizeFactor: (1 / format diff --git a/lib/utilities/text_styles.dart b/lib/utilities/text_styles.dart index 56c313219..71a5808cd 100644 --- a/lib/utilities/text_styles.dart +++ b/lib/utilities/text_styles.dart @@ -1354,4 +1354,45 @@ class STextStyles { ); } } + + static TextStyle currencyTicker(BuildContext context) { + switch (_theme(context).themeType) { + case ThemeType.light: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + background: Paint() + ..color = Theme.of(context).extension()!.highlight + ..strokeWidth = 8 + ..strokeJoin = StrokeJoin.round + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke, + ); + case ThemeType.oceanBreeze: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + background: Paint() + ..color = Theme.of(context).extension()!.highlight + ..strokeWidth = 8 + ..strokeJoin = StrokeJoin.round + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke, + ); + case ThemeType.dark: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + background: Paint() + ..color = Theme.of(context).extension()!.highlight + ..strokeWidth = 8 + ..strokeJoin = StrokeJoin.round + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke, + ); + } + } }