exchange form field ui tweak

This commit is contained in:
julian 2023-02-08 11:25:31 -06:00
parent 83bc26921b
commit 7616538248
2 changed files with 14 additions and 20 deletions

View file

@ -708,10 +708,8 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
onChanged: sendFieldOnChanged,
onButtonTap: selectSendCurrency,
isWalletCoin: isWalletCoin(coin, true),
image: ref.watch(exchangeFormStateProvider
.select((value) => value.sendCurrency?.image)),
ticker: ref.watch(
exchangeFormStateProvider.select((value) => value.fromTicker)),
currency: ref.watch(
exchangeFormStateProvider.select((value) => value.sendCurrency)),
),
SizedBox(
height: isDesktop ? 10 : 4,
@ -800,11 +798,8 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
onChanged: receiveFieldOnChanged,
onButtonTap: selectReceiveCurrency,
isWalletCoin: isWalletCoin(coin, true),
image: ref.watch(exchangeFormStateProvider
.select((value) => value.receiveCurrency?.image)) ??
"",
ticker: ref.watch(
exchangeFormStateProvider.select((value) => value.toTicker)),
currency: ref.watch(exchangeFormStateProvider
.select((value) => value.receiveCurrency)),
readOnly: (rateType) == ExchangeRateType.estimated &&
ref.watch(exchangeProvider).name ==
ChangeNowExchange.exchangeName,

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/isar/exchange_cache/currency.dart';
import 'package:stackwallet/pages/buy_view/sub_widgets/crypto_selection_view.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
@ -23,8 +24,7 @@ class ExchangeTextField extends StatefulWidget {
this.onSubmitted,
this.onTap,
required this.isWalletCoin,
this.image,
this.ticker,
this.currency,
this.readOnly = false,
}) : super(key: key);
@ -42,8 +42,7 @@ class ExchangeTextField extends StatefulWidget {
final bool isWalletCoin;
final bool readOnly;
final String? image;
final String? ticker;
final Currency? currency;
@override
State<ExchangeTextField> createState() => _ExchangeTextFieldState();
@ -115,7 +114,7 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
top: 12,
left: 12,
),
hintText: "0",
hintText: widget.currency == null ? "select currency" : "0",
hintStyle: STextStyles.fieldLabel(context).copyWith(
fontSize: 14,
),
@ -157,18 +156,18 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
),
child: Builder(
builder: (context) {
if (isStackCoin(widget.ticker)) {
if (isStackCoin(widget.currency?.ticker)) {
return Center(
child: getIconForTicker(
widget.ticker!,
widget.currency!.ticker,
size: 18,
),
);
} else if (widget.image != null &&
widget.image!.isNotEmpty) {
} else if (widget.currency != null &&
widget.currency!.image.isNotEmpty) {
return Center(
child: SvgPicture.network(
widget.image!,
widget.currency!.image,
height: 18,
placeholderBuilder: (_) => Container(
width: 18,
@ -215,7 +214,7 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
width: 6,
),
Text(
widget.ticker?.toUpperCase() ?? "-",
widget.currency?.ticker.toUpperCase() ?? "n/a",
style: STextStyles.smallMed14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!