cake pay country picker (#1779)

* cake pay country picker

* UI changes

* hide picker after the country is set

* Revert "hide picker after the country is set"

This reverts commit cce358b94f.

* show country picker initially

* flags

* minor ui fixes

* Update lib/view_model/cake_pay/cake_pay_cards_list_view_model.dart

---------

Co-authored-by: tuxpizza <tuxsudo@tux.pizza>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii 2024-11-07 07:50:48 +02:00 committed by GitHub
parent c8cfc2cff1
commit 48457fdd6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
132 changed files with 601 additions and 78 deletions

View file

@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:cake_wallet/cake_pay/cake_pay_order.dart';
import 'package:cake_wallet/cake_pay/cake_pay_user_credentials.dart';
import 'package:cake_wallet/cake_pay/cake_pay_vendor.dart';
import 'package:cake_wallet/entities/country.dart';
import 'package:http/http.dart' as http;
class CakePayApi {
@ -171,7 +172,7 @@ class CakePayApi {
}
/// Get Countries
Future<List<String>> getCountries(
Future<List<Country>> getCountries(
{required String CSRFToken, required String authorization}) async {
final uri = Uri.https(baseCakePayUri, countriesPath);
@ -188,8 +189,11 @@ class CakePayApi {
}
final bodyJson = json.decode(response.body) as List;
return bodyJson.map<String>((country) => country['name'] as String).toList();
return bodyJson
.map<String>((country) => country['name'] as String)
.map((name) => Country.fromCakePayName(name))
.whereType<Country>()
.toList();
}
/// Get Vendors