Cw 746 improve handling of unsupported exchange provider pairs (#1994)

* Improve handling of unsupported exchange provider

* Update exchange_page.dart
This commit is contained in:
Serhii
2025-02-17 23:43:45 +02:00
committed by GitHub
parent 7c7ea03946
commit 21b86b42eb
30 changed files with 91 additions and 17 deletions
+33 -15
View File
@@ -212,26 +212,44 @@ class ExchangePage extends BasePage {
: S.of(context).fixed_pair_not_supported
: exchangeViewModel.isAvailableInSelected
? S.of(context).amount_is_estimate
: S.of(context).variable_pair_not_supported;
return Center(
child: Text(
description,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context)
.extension<ExchangePageTheme>()!
.receiveAmountColor,
fontWeight: FontWeight.w500,
fontSize: 12),
),
: S.of(context).this_pair_is_not_supported_warning;
return Row(
children: [
if(description == S.of(context).this_pair_is_not_supported_warning)
Expanded(
child: Container(
alignment: Alignment.centerRight,
child: Icon(Icons.warning_amber_rounded,
color: Theme.of(context).extension<ExchangePageTheme>()!.receiveAmountColor,
size: 26),
),
),
Expanded(
flex: 8,
child: Text(
description,
textAlign: TextAlign.center,
softWrap: true,
overflow: TextOverflow.ellipsis,
maxLines: 3,
style: TextStyle(
color: Theme.of(context)
.extension<ExchangePageTheme>()!
.receiveAmountColor,
fontWeight: FontWeight.w500,
fontSize: 12,
),
),
),
],
);
}),
),
Observer(
builder: (_) => LoadingPrimaryButton(
key: ValueKey('exchange_page_exchange_button_key'),
text: S.of(context).exchange,
onPressed: () {
text: exchangeViewModel.isAvailableInSelected ? S.of(context).exchange : S.of(context).change_selected_exchanges,
onPressed: exchangeViewModel.isAvailableInSelected ? () {
FocusScope.of(context).unfocus();
if (_formKey.currentState != null &&
@@ -260,7 +278,7 @@ class ExchangePage extends BasePage {
);
}
}
},
} : () => PresentProviderPicker(exchangeViewModel: exchangeViewModel).presentProviderPicker(context),
color: Theme.of(context).primaryColor,
textColor: Colors.white,
isDisabled: exchangeViewModel.selectedProviders.isEmpty,
@@ -20,7 +20,7 @@ class PresentProviderPicker extends StatelessWidget {
height: 6);
return TextButton(
onPressed: () => _presentProviderPicker(context),
onPressed: () => presentProviderPicker(context),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
splashFactory: NoSplash.splashFactory,
@@ -62,7 +62,7 @@ class PresentProviderPicker extends StatelessWidget {
));
}
void _presentProviderPicker(BuildContext context) async {
void presentProviderPicker(BuildContext context) async {
await showPopUp<void>(
builder: (BuildContext popUpContext) => CheckBoxPicker(
items: exchangeViewModel.providerList