set form state exchange on ui change

This commit is contained in:
julian 2022-10-18 12:28:47 -06:00
parent ffe3382dda
commit 071b149ac7

View file

@ -5,6 +5,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/exchange/response_objects/estimate.dart'; import 'package:stackwallet/models/exchange/response_objects/estimate.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart'; import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
import 'package:stackwallet/services/exchange/exchange.dart';
import 'package:stackwallet/services/exchange/exchange_response.dart'; import 'package:stackwallet/services/exchange/exchange_response.dart';
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart'; import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
@ -46,6 +47,9 @@ class ExchangeProviderOptions extends ConsumerWidget {
ChangeNowExchange.exchangeName) { ChangeNowExchange.exchangeName) {
ref.read(currentExchangeNameStateProvider.state).state = ref.read(currentExchangeNameStateProvider.state).state =
ChangeNowExchange.exchangeName; ChangeNowExchange.exchangeName;
ref.read(exchangeFormStateProvider).exchange =
Exchange.fromName(
ref.read(currentExchangeNameStateProvider.state).state);
} }
}, },
child: Container( child: Container(
@ -69,6 +73,10 @@ class ExchangeProviderOptions extends ConsumerWidget {
ref ref
.read(currentExchangeNameStateProvider.state) .read(currentExchangeNameStateProvider.state)
.state = value; .state = value;
ref.read(exchangeFormStateProvider).exchange =
Exchange.fromName(ref
.read(currentExchangeNameStateProvider.state)
.state);
} }
}, },
), ),
@ -214,6 +222,9 @@ class ExchangeProviderOptions extends ConsumerWidget {
SimpleSwapExchange.exchangeName) { SimpleSwapExchange.exchangeName) {
ref.read(currentExchangeNameStateProvider.state).state = ref.read(currentExchangeNameStateProvider.state).state =
SimpleSwapExchange.exchangeName; SimpleSwapExchange.exchangeName;
ref.read(exchangeFormStateProvider).exchange =
Exchange.fromName(
ref.read(currentExchangeNameStateProvider.state).state);
} }
}, },
child: Container( child: Container(
@ -237,6 +248,10 @@ class ExchangeProviderOptions extends ConsumerWidget {
ref ref
.read(currentExchangeNameStateProvider.state) .read(currentExchangeNameStateProvider.state)
.state = value; .state = value;
ref.read(exchangeFormStateProvider).exchange =
Exchange.fromName(ref
.read(currentExchangeNameStateProvider.state)
.state);
} }
}, },
), ),