mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
outline currency symbols and use selected symbol in buy form fiat select
This commit is contained in:
parent
f110ffb25c
commit
9b944f51f1
3 changed files with 61 additions and 12 deletions
|
@ -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<BuyForm> {
|
|||
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<BuyForm> {
|
|||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
RoundedContainer(
|
||||
radiusMultiplier: 0.5,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 4),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.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(
|
||||
|
|
|
@ -217,7 +217,7 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
|
|||
: Text(
|
||||
format.simpleCurrencySymbol(
|
||||
_fiats[index].ticker.toUpperCase()),
|
||||
style: STextStyles.largeMedium14(context)
|
||||
style: STextStyles.currencyTicker(context)
|
||||
.apply(
|
||||
fontSizeFactor: (1 /
|
||||
format
|
||||
|
|
|
@ -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<StackColors>()!.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<StackColors>()!.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<StackColors>()!.highlight
|
||||
..strokeWidth = 8
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..strokeCap = StrokeCap.round
|
||||
..style = PaintingStyle.stroke,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue