enhance UI for used addresses (#1337)

* enhance UI for used addresses * Update electrum_wallet_addresses.dart * fix tablet UI --------- Co-authored-by: Serhii <borodenko.sv@gmail.com>

Omar Hatem committed Apr 10, 2024 at 03:28 UTC 8a61ab77800ca2c896d88cbe28e6b9eddecd617f
31 files changed +70 -29
cw_bitcoin/lib/electrum_wallet_addresses.dart
+2
@@ -241,6 +241,8 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
241 final index = _addresses.indexOf(addressRecord);
242 _addresses.remove(addressRecord);
243 _addresses.insert(index, addressRecord);
244 +
245 + updateAddressesByMatch();
246 }
247
248 @action
lib/src/screens/receive/widgets/address_cell.dart
+32 -27
@@ -1,5 +1,6 @@
1 import 'package:auto_size_text/auto_size_text.dart';
2 import 'package:cake_wallet/generated/i18n.dart';
3 +import 'package:cake_wallet/utils/responsive_layout_util.dart';
4 import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
5 import 'package:flutter/material.dart';
6 import 'package:flutter_slidable/flutter_slidable.dart';
@@ -81,41 +82,45 @@ class AddressCell extends StatelessWidget {
82 child: Column(
83 children: [
84 Row(
84 - mainAxisAlignment: MainAxisAlignment.center,
85 + mainAxisAlignment: name.isNotEmpty ? MainAxisAlignment.spaceBetween : MainAxisAlignment.center,
86 mainAxisSize: MainAxisSize.max,
87 children: [
87 - if (isChange)
88 - Padding(
89 - padding: const EdgeInsets.only(right: 8.0),
90 - child: Container(
91 - height: 20,
92 - padding: EdgeInsets.all(4),
93 - decoration: BoxDecoration(
94 - borderRadius: BorderRadius.all(Radius.circular(8.5)),
95 - color: textColor),
96 - alignment: Alignment.center,
97 - child: Text(
98 - S.of(context).unspent_change,
88 + Row(
89 + children: [
90 + if (isChange)
91 + Padding(
92 + padding: const EdgeInsets.only(right: 8.0),
93 + child: Container(
94 + height: 20,
95 + padding: EdgeInsets.all(4),
96 + decoration: BoxDecoration(
97 + borderRadius: BorderRadius.all(Radius.circular(8.5)),
98 + color: textColor),
99 + alignment: Alignment.center,
100 + child: Text(
101 + S.of(context).unspent_change,
102 + style: TextStyle(
103 + color: backgroundColor,
104 + fontSize: 10,
105 + fontWeight: FontWeight.w600,
106 + ),
107 + ),
108 + ),
109 + ),
110 + if (name.isNotEmpty)
111 + Text(
112 + '$name',
113 style: TextStyle(
100 - color: backgroundColor,
101 - fontSize: 10,
114 + fontSize: 14,
115 fontWeight: FontWeight.w600,
116 + color: textColor,
117 ),
118 ),
105 - ),
106 - ),
107 - if (name.isNotEmpty)
108 - Text(
109 - '$name - ',
110 - style: TextStyle(
111 - fontSize: 14,
112 - fontWeight: FontWeight.w600,
113 - color: textColor,
114 - ),
115 - ),
119 + ],
120 + ),
121 Flexible(
122 child: AutoSizeText(
118 - formattedAddress,
123 + responsiveLayoutUtil.shouldRenderTabletUI ? address : formattedAddress,
124 maxLines: 1,
125 overflow: TextOverflow.ellipsis,
126 style: TextStyle(
lib/src/screens/settings/privacy_page.dart
+3 -1
@@ -55,7 +55,9 @@ class PrivacyPage extends BasePage {
55 }),
56 if (_privacySettingsViewModel.isAutoGenerateSubaddressesVisible)
57 SettingsSwitcherCell(
58 - title: S.current.auto_generate_subaddresses,
58 + title: _privacySettingsViewModel.isMoneroWallet
59 + ? S.current.auto_generate_subaddresses
60 + : S.current.auto_generate_addresses,
61 value: _privacySettingsViewModel.isAutoGenerateSubaddressesEnabled,
62 onValueChange: (BuildContext _, bool value) {
63 _privacySettingsViewModel.setAutoGenerateSubaddresses(value);
lib/utils/responsive_layout_util.dart
+4
@@ -46,6 +46,10 @@ abstract class ResponsiveLayoutUtilBase with Store, WidgetsBindingObserver {
46 (orientation == Orientation.portrait && screenWidth < screenHeight) ||
47 (orientation == Orientation.landscape && screenWidth < screenHeight);
48 }
49 +
50 + bool get shouldRenderTabletUI {
51 + return screenWidth > _kMobileThreshold && screenWidth < kDesktopMaxDashBoardWidthConstraint;
52 + }
53 }
54
55 _ResponsiveLayoutUtil _singletonResponsiveLayoutUtil = _ResponsiveLayoutUtil();
lib/view_model/settings/privacy_settings_view_model.dart
+2
@@ -44,6 +44,8 @@ abstract class PrivacySettingsViewModelBase with Store {
44 _wallet.type == WalletType.litecoin ||
45 _wallet.type == WalletType.bitcoinCash;
46
47 + bool get isMoneroWallet => _wallet.type == WalletType.monero;
48 +
49 @computed
50 bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress;
51
res/values/strings_ar.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "PIN خطأ",
60 "authenticated": "تم المصادقة",
61 "authentication": "المصادقة",
62 + "auto_generate_addresses": "تلقائي توليد العناوين",
63 "auto_generate_subaddresses": "تلقائي توليد subddresses",
64 "automatic": "تلقائي",
65 "available_balance": "الرصيد المتوفر",
res/values/strings_bg.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Грешен PIN",
60 "authenticated": "Удостоверено",
61 "authentication": "Удостоверяване",
62 + "auto_generate_addresses": "Автоматично генериране на адреси",
63 "auto_generate_subaddresses": "Автоматично генериране на подадреси",
64 "automatic": "Автоматично",
65 "available_balance": "Наличен баланс",
res/values/strings_cs.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Nesprávný PIN",
60 "authenticated": "Ověřeno",
61 "authentication": "Ověřování",
62 + "auto_generate_addresses": "Automatické generování adres",
63 "auto_generate_subaddresses": "Automaticky generovat podadresy",
64 "automatic": "Automatický",
65 "available_balance": "Dostupný zůstatek",
res/values/strings_de.arb
+2 -1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Falsche PIN",
60 "authenticated": "Authentifiziert",
61 "authentication": "Authentifizierung",
62 + "auto_generate_addresses": "Automatisch generieren Adressen",
63 "auto_generate_subaddresses": "Unteradressen automatisch generieren",
64 "automatic": "Automatisch",
65 "available_balance": "Verfügbares Guthaben",
@@ -422,8 +423,8 @@
423 "placeholder_transactions": "Ihre Transaktionen werden hier angezeigt",
424 "please_fill_totp": "Bitte geben Sie den 8-stelligen Code ein, der auf Ihrem anderen Gerät vorhanden ist",
425 "please_make_selection": "Bitte treffen Sie unten eine Auswahl zum Erstellen oder Wiederherstellen Ihrer Wallet.",
425 - "please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.",
426 "Please_reference_document": "Weitere Informationen finden Sie in den Dokumenten unten.",
427 + "please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.",
428 "please_select": "Bitte auswählen:",
429 "please_select_backup_file": "Bitte wählen Sie die Sicherungsdatei und geben Sie das Sicherungskennwort ein.",
430 "please_try_to_connect_to_another_node": "Bitte versuchen Sie, sich mit einem anderen Knoten zu verbinden",
res/values/strings_en.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Wrong PIN",
60 "authenticated": "Authenticated",
61 "authentication": "Authentication",
62 + "auto_generate_addresses": "Auto generate addresses",
63 "auto_generate_subaddresses": "Auto generate subaddresses",
64 "automatic": "Automatic",
65 "available_balance": "Available Balance",
res/values/strings_es.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Contraseña PIN",
60 "authenticated": "Autenticados",
61 "authentication": "Autenticación",
62 + "auto_generate_addresses": "Auto Generar direcciones",
63 "auto_generate_subaddresses": "Generar subdirecciones automáticamente",
64 "automatic": "Automático",
65 "available_balance": "Balance disponible",
res/values/strings_fr.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Mauvais code PIN",
60 "authenticated": "Authentifié",
61 "authentication": "Authentification",
62 + "auto_generate_addresses": "Adresses de génération automatique",
63 "auto_generate_subaddresses": "Générer automatiquement des sous-adresses",
64 "automatic": "Automatique",
65 "available_balance": "Solde Disponible",
res/values/strings_ha.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "PIN na gaskiya",
60 "authenticated": "Ingantacce",
61 "authentication": "Tabbatarwa",
62 + "auto_generate_addresses": "Adireshin Auto",
63 "auto_generate_subaddresses": "Saɓaƙa subaddresses ta kai tsaye",
64 "automatic": "Na atomatik",
65 "available_balance": "KUDI",
res/values/strings_hi.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "गलत पिन",
60 "authenticated": "प्रमाणीकृत",
61 "authentication": "प्रमाणीकरण",
62 + "auto_generate_addresses": "ऑटो उत्पन्न पते",
63 "auto_generate_subaddresses": "स्वचालित रूप से उप-पते उत्पन्न करें",
64 "automatic": "स्वचालित",
65 "available_balance": "उपलब्ध शेष राशि",
res/values/strings_hr.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Pogrešan PIN",
60 "authenticated": "Autentificiran",
61 "authentication": "Autentifikacija",
62 + "auto_generate_addresses": "Automatsko generiranje adresa",
63 "auto_generate_subaddresses": "Automatski generirajte podadrese",
64 "automatic": "Automatski",
65 "available_balance": "Raspoloživ iznos",
res/values/strings_id.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "PIN yang salah",
60 "authenticated": "Terotentikasi",
61 "authentication": "Otentikasi",
62 + "auto_generate_addresses": "Auto menghasilkan alamat",
63 "auto_generate_subaddresses": "Menghasilkan subalamat secara otomatis",
64 "automatic": "Otomatis",
65 "available_balance": "Saldo Tersedia",
res/values/strings_it.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "PIN non corretto",
60 "authenticated": "Autenticato",
61 "authentication": "Autenticazione",
62 + "auto_generate_addresses": "Auto Genera indirizzi",
63 "auto_generate_subaddresses": "Genera automaticamente sottindirizzi",
64 "automatic": "Automatico",
65 "available_balance": "Saldo Disponibile",
res/values/strings_ja.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "間違ったPIN",
60 "authenticated": "認証済み",
61 "authentication": "認証",
62 + "auto_generate_addresses": "Autoはアドレスを生成します",
63 "auto_generate_subaddresses": "Autoはサブアドレスを生成します",
64 "automatic": "自動",
65 "available_balance": "利用可能残高",
res/values/strings_ko.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "잘못된 PIN",
60 "authenticated": "인증",
61 "authentication": "입증",
62 + "auto_generate_addresses": "자동 생성 주소",
63 "auto_generate_subaddresses": "자동 생성 서브 아드 드레스",
64 "automatic": "자동적 인",
65 "available_balance": "사용 가능한 잔액",
res/values/strings_my.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "ပင်နံပါတ် မှားနေသည်။",
60 "authenticated": "အစစ်အမှန်",
61 "authentication": "စစ်ဆေးခြင်း",
62 + "auto_generate_addresses": "Auto Generate လိပ်စာများ",
63 "auto_generate_subaddresses": "အော်တို Generate Subaddresses",
64 "automatic": "အလိုအလျောက်",
65 "available_balance": "လက်ကျန်ငွေ ရရှိနိုင်",
res/values/strings_nl.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Incorrect PIN",
60 "authenticated": "Authenticated",
61 "authentication": "Authenticatie",
62 + "auto_generate_addresses": "Auto -genereer adressen",
63 "auto_generate_subaddresses": "Automatisch subadressen genereren",
64 "automatic": "automatisch",
65 "available_balance": "Beschikbaar saldo",
res/values/strings_pl.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Niepoprawny PIN",
60 "authenticated": "Uwierzytelniony",
61 "authentication": "Uwierzytelnianie",
62 + "auto_generate_addresses": "Auto generują adresy",
63 "auto_generate_subaddresses": "Automatycznie generuj podadresy",
64 "automatic": "Automatyczny",
65 "available_balance": "Dostępne środki",
res/values/strings_pt.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "PIN incorreto",
60 "authenticated": "Autenticado",
61 "authentication": "Autenticação",
62 + "auto_generate_addresses": "Endereços gerados automaticamente",
63 "auto_generate_subaddresses": "Gerar subendereços automaticamente",
64 "automatic": "Automático",
65 "available_balance": "Saldo disponível",
res/values/strings_ru.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Некорректный PIN",
60 "authenticated": "Аутентифицировано",
61 "authentication": "Аутентификация",
62 + "auto_generate_addresses": "Авто генерируйте адреса",
63 "auto_generate_subaddresses": "Авто генерируйте Subaddresses",
64 "automatic": "автоматический",
65 "available_balance": "Доступный баланс",
res/values/strings_th.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "รหัสผ่านไม่ถูกต้อง",
60 "authenticated": "ได้รับการยืนยันสิทธิ์",
61 "authentication": "การยืนยันสิทธิ์",
62 + "auto_generate_addresses": "สร้างที่อยู่อัตโนมัติ",
63 "auto_generate_subaddresses": "Auto สร้าง subaddresses",
64 "automatic": "อัตโนมัติ",
65 "available_balance": "ยอดคงเหลือที่ใช้งานได้",
res/values/strings_tl.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Maling pin",
60 "authenticated": "Napatunayan",
61 "authentication": "Pagpapatunay",
62 + "auto_generate_addresses": "Auto bumuo ng mga address",
63 "auto_generate_subaddresses": "Ang Auto ay bumubuo ng mga subaddresses",
64 "automatic": "Awtomatiko",
65 "available_balance": "Magagamit na balanse",
res/values/strings_tr.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Hatalı PIN",
60 "authenticated": "Doğrulandı",
61 "authentication": "Doğrulama",
62 + "auto_generate_addresses": "Otomatik Adres Oluşturma",
63 "auto_generate_subaddresses": "Alt adresleri otomatik olarak oluştur",
64 "automatic": "Otomatik",
65 "available_balance": "Kullanılabilir Bakiye",
res/values/strings_uk.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Некоректний PIN",
60 "authenticated": "Аутентифіковано",
61 "authentication": "Аутентифікація",
62 + "auto_generate_addresses": "Авто генерувати адреси",
63 "auto_generate_subaddresses": "Автоматично генерувати підадреси",
64 "automatic": "Автоматичний",
65 "available_balance": "Доступний баланс",
res/values/strings_ur.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "غلط PIN",
60 "authenticated": "تصدیق شدہ",
61 "authentication": "تصدیق",
62 + "auto_generate_addresses": "آٹو پیدا کرنے والے پتے",
63 "auto_generate_subaddresses": "آٹو سب ایڈریس تیار کرتا ہے",
64 "automatic": "خودکار",
65 "available_balance": "دستیاب بیلنس",
res/values/strings_yo.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "Òǹkà ìdánimọ̀ àdáni kọ́ ni èyí",
60 "authenticated": "A ti jẹ́rìísí yín",
61 "authentication": "Ìfẹ̀rílàdí",
62 + "auto_generate_addresses": "Awọn adirẹsi ṣe agbekalẹ awọn adirẹsi",
63 "auto_generate_subaddresses": "Aṣiṣe Ibi-Afọwọkọ",
64 "automatic": "Ó máa ń ṣàdédé",
65 "available_balance": "Ìyókù owó tó wà níbẹ̀",
res/values/strings_zh.arb
+1
@@ -59,6 +59,7 @@
59 "auth_store_incorrect_password": "PIN码错误",
60 "authenticated": "已认证",
61 "authentication": "认证方式",
62 + "auto_generate_addresses": "自动生成地址",
63 "auto_generate_subaddresses": "自动生成子辅助",
64 "automatic": "自动的",
65 "available_balance": "可用余额",