From 7c7ddf8205d032b403ea14ca7772fe27a45eee27 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Wed, 24 Jun 2026 11:00:51 +0200
Subject: [PATCH 01/48] tx history improved layout (wip)
---
.../assets_history_section.dart | 1 +
.../assets_history/history_section.dart | 19 ++++++++++++-------
.../dashboard/dashboard_view_model.dart | 6 ++++++
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index 998ebc137..e57f46c79 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -43,6 +43,7 @@ class _AssetsHistorySectionState extends State {
S.current.history,
HistorySection(
dashboardViewModel: widget.dashboardViewModel,
+ short: true,
)),
if (isNFTACtivatedChain(widget.dashboardViewModel.wallet.type,
chainId: widget.dashboardViewModel.wallet.chainId))
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
index 32d99020b..e4ecd6230 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/anonpay_history_tile.dart';
@@ -22,16 +24,19 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:intl/intl.dart';
class HistorySection extends StatelessWidget {
- const HistorySection({super.key, required this.dashboardViewModel});
+ const HistorySection({super.key, required this.dashboardViewModel, required this.short});
final DashboardViewModel dashboardViewModel;
+ final bool short;
@override
Widget build(BuildContext context) {
+ final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
+
return SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
sliver: Observer(
- builder: (_) => (dashboardViewModel.items.isEmpty)
+ builder: (_) => (items.isEmpty)
? SliverPadding(
padding: EdgeInsets.only(top: 24),
sliver: SliverToBoxAdapter(
@@ -48,14 +53,14 @@ class HistorySection extends StatelessWidget {
)
: SliverList(
delegate: SliverChildBuilderDelegate(
- childCount: dashboardViewModel.items.length,
+ childCount: items.length,
(context, index) => Observer(builder: (_) {
- final prevItem = index == 0 ? null : dashboardViewModel.items[index - 1];
+ final prevItem = index == 0 ? null : items[index - 1];
final topPadding = index == 0 ? 0.0 : 18.0;
- final item = dashboardViewModel.items[index];
- final nextItem = index == dashboardViewModel.items.length - 1
+ final item = items[index];
+ final nextItem = index == items.length - 1
? null
- : dashboardViewModel.items[index + 1];
+ : items[index + 1];
final roundedBottom = (nextItem == null || nextItem is DateSectionItem);
final roundedTop = (prevItem == null || prevItem is DateSectionItem);
diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart
index d97d119a4..1a2e476e0 100644
--- a/lib/view_model/dashboard/dashboard_view_model.dart
+++ b/lib/view_model/dashboard/dashboard_view_model.dart
@@ -5,6 +5,7 @@ import 'dart:io' show Platform;
import 'package:cake_wallet/.secrets.g.dart' as secrets;
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/core/key_service.dart';
+import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
import "package:cw_core/balance_card_style_settings.dart";
import 'package:cake_wallet/core/trade_monitor.dart';
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
@@ -715,6 +716,11 @@ abstract class DashboardViewModelBase with Store {
return formattedItemsList(_items);
}
+ static const shortHistoryLength = 3;
+
+ @computed
+ List get itemsShort => items.where((item)=>item is! DateSectionItem).take(3).toList();
+
@observable
WalletBase, TransactionInfo> wallet;
From ac60a6eccea86566e9c32bc0ff44532e87def71d Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 01:40:34 +0200
Subject: [PATCH 02/48] tx history improved layout
---
.../list_item/list_Item_checkbox.dart | 2 +
.../assets_history_section.dart | 24 +-
.../assets_history/assets_top_bar.dart | 52 +---
.../assets_history/history_filters_page.dart | 117 ++++++++
.../assets_history/history_modal.dart | 119 ++++++++
.../assets_history/history_section.dart | 74 ++++-
.../history_swap_providers_page.dart | 75 +++++
.../assets_history/history_tile_base.dart | 4 +-
.../assets_history/history_top_bar.dart | 56 ++++
.../transaction_details_modal.dart | 276 +++++++++---------
lib/new-ui/widgets/select_deselect_all.dart | 39 +++
lib/router.dart | 2 +-
.../screens/dashboard/widgets/header_row.dart | 5 -
.../list_item_checkbox_widget.dart | 4 +-
.../new_list_row/new_list_section.dart | 1 +
lib/store/dashboard/trade_filter_store.dart | 19 ++
.../dashboard/dashboard_view_model.dart | 221 +++++++-------
.../dashboard/date_section_item.dart | 32 +-
lib/view_model/dashboard/filter_item.dart | 30 +-
.../dashboard/formatted_item_list.dart | 103 ++++---
res/values/strings_en.arb | 6 +
21 files changed, 916 insertions(+), 345 deletions(-)
create mode 100644 lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart
create mode 100644 lib/new-ui/widgets/coins_page/assets_history/history_modal.dart
create mode 100644 lib/new-ui/widgets/coins_page/assets_history/history_swap_providers_page.dart
create mode 100644 lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
create mode 100644 lib/new-ui/widgets/select_deselect_all.dart
diff --git a/lib/entities/new_ui_entities/list_item/list_Item_checkbox.dart b/lib/entities/new_ui_entities/list_item/list_Item_checkbox.dart
index c02f076e0..2f84a3726 100644
--- a/lib/entities/new_ui_entities/list_item/list_Item_checkbox.dart
+++ b/lib/entities/new_ui_entities/list_item/list_Item_checkbox.dart
@@ -6,6 +6,7 @@ class ListItemCheckbox extends ListItem {
required super.keyValue,
required super.label,
this.subtitle,
+ this.subtitleColor,
this.iconPath,
this.onTap,
this.showArrow = false,
@@ -18,5 +19,6 @@ class ListItemCheckbox extends ListItem {
final bool value;
final String? subtitle;
final String? iconPath;
+ final Color? subtitleColor;
final bool showArrow;
}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index e57f46c79..ecc163092 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -1,11 +1,15 @@
import 'package:cake_wallet/generated/i18n.dart';
+import 'package:cake_wallet/new-ui/modal_navigator.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart';
+import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_modal.dart';
+import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_top_bar.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart';
import 'package:cake_wallet/src/screens/dashboard/pages/nft_listing_page.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
import 'package:flutter/material.dart';
import 'package:mobx/mobx.dart';
+import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'assets_section.dart';
import 'history_section.dart';
@@ -42,6 +46,8 @@ class _AssetsHistorySectionState extends State {
AssetsHistorySectionTab(
S.current.history,
HistorySection(
+ detailsAsPage: false,
+ roundedTopSection: tabs.length > 1,
dashboardViewModel: widget.dashboardViewModel,
short: true,
)),
@@ -71,8 +77,9 @@ class _AssetsHistorySectionState extends State {
Widget build(BuildContext context) {
return SliverMainAxisGroup(
slivers: [
- // if(tabs.length>1)
+ if(tabs.length>1)
AssetsTopBar(
+ onTransactionHistoryOpened: () => openHistoryModal(context),
dashboardViewModel: widget.dashboardViewModel,
tabs: tabs.map((item) => item.title).toList(),
onTabChange: (index) {
@@ -82,8 +89,23 @@ class _AssetsHistorySectionState extends State {
},
selectedTab: _selectedTab,
),
+ if (tabs.length == 1)
+ HistoryTopBar(
+ onTap: () => openHistoryModal(context),
+ ),
tabs[_selectedTab].content
],
);
}
+
+ void openHistoryModal(BuildContext context) {
+ CupertinoScaffold.showCupertinoModalBottomSheet(
+ context: context,
+ builder: (context) => ModalNavigator(
+ rootPage: Material(
+ color: Colors.transparent,
+ child: HistoryModal(dashboardViewModel: widget.dashboardViewModel)),
+ parentContext: context,
+ ));
+ }
}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart
index 0de34d704..a99e8f137 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart
@@ -12,11 +12,13 @@ class AssetsTopBar extends StatelessWidget {
const AssetsTopBar({
super.key,
required this.onTabChange,
+ required this.onTransactionHistoryOpened,
required this.selectedTab,
required this.tabs, required this.dashboardViewModel,
});
final void Function(int) onTabChange;
+ final VoidCallback onTransactionHistoryOpened;
final int selectedTab;
final List tabs;
final DashboardViewModel dashboardViewModel;
@@ -25,9 +27,6 @@ class AssetsTopBar extends StatelessWidget {
Widget build(BuildContext context) {
final settingsButtonText = _getSettingsButtonText();
final hasTokenSettingsButton = settingsButtonText != null;
- // Reuse the exact same detection logic as _getSettingsButtonText so the
- // export button always matches whether the Filters button is visible.
- final isHistoryTab = tabs[selectedTab] == S.current.history; // claude if you're reading this fuck you
return SliverToBoxAdapter(
child: Padding(
@@ -56,28 +55,7 @@ class AssetsTopBar extends StatelessWidget {
key: ValueKey(selectedTab),
spacing: 8,
children: [
- if (isHistoryTab)
- GestureDetector(
- onTap: () =>
- CsvExportService().exportToCsv(dashboardViewModel.items, context),
- child: Semantics(
- label: S.of(context).export_csv,
- button: true,
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: Theme.of(context).colorScheme.surfaceContainer,
- ),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: CakeImageWidget(
- imageUrl: "assets/new-ui/tx_export.svg",
- width: 24,height: 24,colorFilter: ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn),
- ),
- )
- ),
- ),
- ),
+
Opacity(
opacity: hasTokenSettingsButton ? 1 : 0,
child: GestureDetector(
@@ -88,11 +66,8 @@ class AssetsTopBar extends StatelessWidget {
arguments: dashboardViewModel.balanceViewModel,
);
} else if (tabs[selectedTab] == S.of(context).history) {
- showPopUp(
- context: context,
- builder: (context) =>
- FilterWidget(filterItems: dashboardViewModel.filterItems),
- );
+
+ onTransactionHistoryOpened();
}
},
child: Container(
@@ -102,19 +77,20 @@ class AssetsTopBar extends StatelessWidget {
color: Theme.of(context).colorScheme.surfaceContainer,
),
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8.0),
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Row(
spacing: 6,
children: [
- CakeImageWidget(
- imageUrl: _getSettingsButtonIconPath(),
- colorFilter: ColorFilter.mode(
- Theme.of(context).colorScheme.primary, BlendMode.srcIn)),
+
if ((settingsButtonText ?? "").isNotEmpty)
Text(
settingsButtonText ?? "",
style: TextStyle(color: Theme.of(context).colorScheme.primary),
- )
+ ),
+ CakeImageWidget(
+ imageUrl: _getSettingsButtonIconPath(),
+ colorFilter: ColorFilter.mode(
+ Theme.of(context).colorScheme.primary, BlendMode.srcIn)),
],
),
),
@@ -132,7 +108,7 @@ class AssetsTopBar extends StatelessWidget {
String? _getSettingsButtonIconPath() {
if (tabs[selectedTab] == S.current.history) {
- return "assets/new-ui/filter_options.svg";
+ return "assets/new-ui/arrow_right.svg";
}
if (tabs[selectedTab] == S.current.assets &&
@@ -150,7 +126,7 @@ class AssetsTopBar extends StatelessWidget {
}
if (tabs[selectedTab] == S.current.history) {
- return "";
+ return S.current.all_pascal_case;
}
return null;
}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart b/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart
new file mode 100644
index 000000000..3a71a86cb
--- /dev/null
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart
@@ -0,0 +1,117 @@
+import 'package:cake_wallet/entities/new_ui_entities/list_item/list_Item_checkbox.dart';
+import 'package:cake_wallet/exchange/exchange_provider_description.dart';
+import 'package:cake_wallet/generated/i18n.dart';
+import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_swap_providers_page.dart';
+import 'package:cake_wallet/new-ui/widgets/new_primary_button.dart';
+import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
+import 'package:cake_wallet/new-ui/widgets/select_deselect_all.dart';
+import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
+import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
+import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_mobx/flutter_mobx.dart';
+import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
+
+class HistoryFiltersPage extends StatelessWidget {
+ const HistoryFiltersPage({super.key, required this.dashboardViewModel});
+
+ final DashboardViewModel dashboardViewModel;
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ color: Theme.of(context).colorScheme.surface,
+ child: Column(
+ children: [
+ ModalTopBar(
+ title: S.of(context).filters,
+ leadingIcon: Icon(Icons.arrow_back_ios_new),
+ onLeadingPressed: Navigator.of(context).pop,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ controller: ModalScrollController.of(context),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 18.0),
+ child: Observer(
+ builder: (_) => Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(bottom: 12.0),
+ child: Material(
+ color: Colors.transparent,
+ child: SelectDeselectAllBar(
+ title: S.of(context).type,
+ onSelected: dashboardViewModel.changeAllFilterItems),
+ ),
+ ),
+ NewListSections(
+ sections: {
+ "": dashboardViewModel.filterItems.map((item) {
+ if (item is SwapFilterItem) {
+ final String subtitle;
+ final Color subtitleColor;
+ if (item.value()) {
+ subtitle = S.of(context).manage_providers;
+ subtitleColor = Theme.of(context).colorScheme.onSurfaceVariant;
+ } else if (dashboardViewModel.tradeFilterStore.enabledProviders == 0) {
+ subtitle = S.of(context).no_providers_selected;
+ subtitleColor = Color(0xFFFFB84E);
+ } else {
+ subtitle = "${item.enabledProviders()} ${S.of(context).providers}";
+ subtitleColor = Theme.of(context).colorScheme.primary;
+ }
+
+ return ListItemCheckbox(
+ onTap: () {
+ Navigator.of(context).push(CupertinoPageRoute(
+ builder: (context) => HistorySwapProvidersPage(
+ dashboardViewModel: dashboardViewModel)));
+ },
+ keyValue: item.caption,
+ label: S.of(context).swap,
+ value: item.value(),
+ onChanged: (val) {
+ if ((val &&
+ dashboardViewModel.tradeFilterStore.enabledProviders ==
+ 0) ||
+ (!val &&
+ dashboardViewModel.tradeFilterStore.enabledProviders >
+ 0)) {
+ dashboardViewModel.tradeFilterStore
+ .toggleDisplayExchange(ExchangeProviderDescription.all);
+ }
+ },
+ subtitle: subtitle,
+ subtitleColor: subtitleColor,
+ showArrow: true);
+ }
+
+ return ListItemCheckbox(
+ keyValue: item.caption,
+ label: item.caption,
+ value: item.value(),
+ onChanged: (val) => item.onChanged());
+ }).toList()
+ },
+ ),
+ ],
+ ),
+ ),
+ ),
+ )),
+ SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.all(18.0),
+ child: NewPrimaryButton(
+ onPressed: () => dashboardViewModel.changeAllFilterItems(true),
+ text: S.of(context).reset_filters,
+ color: Theme.of(context).colorScheme.surfaceContainer,
+ textColor: Theme.of(context).colorScheme.primary),
+ ))
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart b/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart
new file mode 100644
index 000000000..9b93a9d0c
--- /dev/null
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart
@@ -0,0 +1,119 @@
+import 'package:cake_wallet/core/csv_export_service.dart';
+import 'package:cake_wallet/generated/i18n.dart';
+import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_filters_page.dart';
+import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_section.dart';
+import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
+import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
+import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
+
+class HistoryModal extends StatelessWidget {
+ const HistoryModal({super.key, required this.dashboardViewModel});
+
+ final DashboardViewModel dashboardViewModel;
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.surface,
+ borderRadius: BorderRadius.vertical(top: Radius.circular(18))),
+ child: Column(
+ children: [
+ ModalTopBar(
+ title: S.of(context).history,
+ leadingIcon: Icon(Icons.close),
+ onLeadingPressed: Navigator.of(context).maybePop,
+ trailingIcon: CakeImageWidget(
+ imageUrl: "assets/new-ui/tx_export.svg",
+ colorFilter: ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn),
+ ),
+ onTrailingPressed: () =>
+ CsvExportService().exportToCsv(dashboardViewModel.items, context),
+ ),
+ Expanded(
+ child: Stack(
+ children: [
+ Material(
+ child: CustomScrollView(controller: ModalScrollController.of(context), slivers: [
+ HistorySection(
+ detailsAsPage: true,
+ dashboardViewModel: dashboardViewModel,
+ short: false,
+ roundedTopSection: true)
+ ])),
+ Positioned(
+ bottom: 0,
+ left: 0,
+ right: 0,
+ child: Material(
+ color: Colors.transparent,
+ child: Container(
+ height: MediaQuery.of(context).viewPadding.bottom + 168,
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.bottomCenter,
+ end: Alignment.topCenter,
+ colors: [
+ Theme.of(context).colorScheme.surface.withAlpha(200),
+ Theme.of(context).colorScheme.surface.withAlpha(175),
+ Theme.of(context).colorScheme.surface.withAlpha(150),
+ Theme.of(context).colorScheme.surface.withAlpha(100),
+ Theme.of(context).colorScheme.surface.withAlpha(50),
+ Theme.of(context).colorScheme.surface.withAlpha(25),
+ Theme.of(context).colorScheme.surface.withAlpha(5),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ Positioned(
+ left: 12,
+ right: 12,
+ bottom: MediaQuery.of(context).viewPadding.bottom + 24,
+ child: Material(
+ borderRadius: BorderRadius.circular(18),
+ color: Theme.of(context).colorScheme.surfaceContainer,
+ child: InkWell(
+ borderRadius: BorderRadius.circular(18),
+ onTap: () {
+ Navigator.of(context).push(CupertinoPageRoute(
+ builder: (context) =>
+ HistoryFiltersPage(dashboardViewModel: dashboardViewModel)));
+ },
+ child: Material(
+ color: Colors.transparent,
+ child: SizedBox(
+ height: 56,
+ width: double.infinity,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ spacing: 10,
+ children: [
+ CakeImageWidget(
+ imageUrl: "assets/new-ui/filter_options.svg",
+ colorFilter: ColorFilter.mode(
+ Theme.of(context).colorScheme.primary, BlendMode.srcIn),
+ ),
+ Text(
+ S.of(context).filters,
+ style: TextStyle(
+ fontWeight: FontWeight.w500,
+ color: Theme.of(context).colorScheme.primary),
+ )
+ ],
+ ),
+ ),
+ ),
+ ),
+ ))
+ ],
+ ))
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
index e4ecd6230..fd2e08145 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
@@ -19,22 +19,25 @@ import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
import 'package:cake_wallet/view_model/dashboard/transaction_list_item.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/sync_status.dart';
+import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:intl/intl.dart';
class HistorySection extends StatelessWidget {
- const HistorySection({super.key, required this.dashboardViewModel, required this.short});
+ const HistorySection({super.key, required this.dashboardViewModel, required this.short, required this.roundedTopSection, required this.detailsAsPage});
final DashboardViewModel dashboardViewModel;
final bool short;
+ final bool roundedTopSection;
+ final bool detailsAsPage;
@override
Widget build(BuildContext context) {
final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
return SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ padding: EdgeInsets.only(left: 16.0, right: 16, top: short && roundedTopSection ? 18 : 0),
sliver: Observer(
builder: (_) => (items.isEmpty)
? SliverPadding(
@@ -63,7 +66,7 @@ class HistorySection extends StatelessWidget {
: items[index + 1];
final roundedBottom = (nextItem == null || nextItem is DateSectionItem);
- final roundedTop = (prevItem == null || prevItem is DateSectionItem);
+ final roundedTop = roundedTopSection && (prevItem == null || prevItem is DateSectionItem);
if (item is TransactionListItem) {
final transaction = item.transaction;
@@ -82,14 +85,20 @@ class HistorySection extends StatelessWidget {
return GestureDetector(
onTap: () {
final page = getIt.get(param1: transaction);
- showModalBottomSheet(
- isScrollControlled: true,
- context: context,
- builder: (context) => page);
+ if (detailsAsPage) {
+ Navigator.of(context).push(
+ CupertinoPageRoute(builder: (context) => Material(child: page)));
+ } else {
+ showModalBottomSheet(
+ isScrollControlled: true,
+ context: context,
+ builder: (context) =>
+ FractionallySizedBox(heightFactor: 0.9, child: page));
+ }
},
child: HistoryTile(
title: item.formattedTitle + transactionType,
- date: DateFormat('HH:mm').format(transaction.date),
+ date: _formatTransactionDate(item.date),
amount: item.formattedCryptoAmount,
amountFiat: item.formattedFiatAmount,
hasTokens: item.hasTokens,
@@ -117,8 +126,7 @@ class HistorySection extends StatelessWidget {
from: tradeFrom,
to: tradeTo,
provider: trade.provider,
- date:
- DateFormat('HH:mm').format(item.trade.createdAt ?? DateTime.now()),
+ date: _formatTransactionDate(item.trade.createdAt ?? DateTime.now()),
amount: trade.amountFormatted(),
receiveAmount: trade.receiveAmountFormatted(),
roundedBottom: roundedBottom,
@@ -127,10 +135,16 @@ class HistorySection extends StatelessWidget {
swapState: trade.state,
),
);
+ } else if (item is SpecificDateSectionItem) {
+ return Padding(
+ padding: EdgeInsets.only(left: 8.0, bottom: 8.0, top: topPadding),
+ child: Text(item.text,
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.onSurfaceVariant)));
} else if (item is DateSectionItem) {
return Padding(
padding: EdgeInsets.only(left: 8.0, bottom: 8.0, top: topPadding),
- child: Text(DateFormatter.convertDateTimeToReadableString(item.date),
+ child: Text(DateFormat("MMMM yyyy").format(item.date),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)));
} else if (item is OrderListItem) {
@@ -138,7 +152,7 @@ class HistorySection extends StatelessWidget {
onTap: () => Navigator.of(context)
.pushNamed(Routes.orderDetails, arguments: item.order),
child: HistoryOrderTile(
- date: DateFormat('HH:mm').format(item.order.createdAt),
+ date: _formatTransactionDate(item.order.createdAt),
amount: item.orderFormattedAmount,
amountFiat: "USD 0.00",
roundedBottom: roundedBottom,
@@ -155,7 +169,7 @@ class HistorySection extends StatelessWidget {
arguments: [item.sessionId, item.transaction],
),
child: PayjoinHistoryTile(
- createdAt: DateFormat('HH:mm').format(session.inProgressSince!),
+ createdAt: _formatTransactionDate(session.inProgressSince!),
amount: dashboardViewModel.appStore.amountParsingProxy
.getDisplayCryptoString(
session.amount.toInt(), CryptoCurrency.btc),
@@ -174,7 +188,7 @@ class HistorySection extends StatelessWidget {
.pushNamed(Routes.anonPayDetailsPage, arguments: transactionInfo),
child: AnonpayHistoryTile(
provider: transactionInfo.provider,
- createdAt: DateFormat('HH:mm').format(transactionInfo.createdAt),
+ createdAt: _formatTransactionDate(transactionInfo.createdAt),
amount: transactionInfo.fiatAmount?.toString() ??
(transactionInfo.amountTo?.toString() ?? ''),
currency: transactionInfo.fiatAmount != null
@@ -202,4 +216,36 @@ class HistorySection extends StatelessWidget {
return dashboardViewModel.wallet.currency.chainIconPath ?? "";
}
}
+
+ String _formatTransactionDate(DateTime date) {
+ final time = DateFormat.Hm();
+
+ final now = DateTime.now();
+ final today = DateTime(now.year, now.month, now.day);
+ final thatDay = DateTime(date.year, date.month, date.day);
+ final daysAgo = today.difference(thatDay).inDays;
+
+ final timeStr = time.format(date);
+
+ if (daysAgo == 0) {
+ return timeStr;
+ }
+
+ if (daysAgo == 1) {
+ return "${S.current.yesterday}, $timeStr";
+ }
+
+ if (daysAgo < 7) {
+ final weekday = DateFormat.EEEE().format(date);
+ return '$weekday, $timeStr';
+ }
+
+ if (date.year == now.year) {
+ final dayMonth = DateFormat("d MMMM").format(date);
+ return '$dayMonth, $timeStr';
+ }
+
+ final full = DateFormat("d MMMM yyyy").format(date);
+ return '$full, $timeStr';
+ }
}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_swap_providers_page.dart b/lib/new-ui/widgets/coins_page/assets_history/history_swap_providers_page.dart
new file mode 100644
index 000000000..1010e4c4a
--- /dev/null
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_swap_providers_page.dart
@@ -0,0 +1,75 @@
+import 'package:cake_wallet/entities/new_ui_entities/list_item/list_Item_checkbox.dart';
+import 'package:cake_wallet/exchange/exchange_provider_description.dart';
+import 'package:cake_wallet/generated/i18n.dart';
+import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
+import 'package:cake_wallet/new-ui/widgets/select_deselect_all.dart';
+import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
+import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
+import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_mobx/flutter_mobx.dart';
+import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
+
+class HistorySwapProvidersPage extends StatelessWidget {
+ const HistorySwapProvidersPage({super.key, required this.dashboardViewModel});
+
+ final DashboardViewModel dashboardViewModel;
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ color: Theme.of(context).colorScheme.surface,
+ child: Column(
+ children: [
+ ModalTopBar(
+ title: S.of(context).filter_swap_providers,
+ leadingIcon: Icon(Icons.arrow_back_ios_new),
+ onLeadingPressed: Navigator.of(context).pop,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ controller: ModalScrollController.of(context),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 18.0),
+ child: Observer(
+ builder: (_) => Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(bottom: 12.0),
+ child: Material(
+ color: Colors.transparent,
+ child: SelectDeselectAllBar(
+ title: S.of(context).swap_providers,
+ onSelected: (val) {
+ if ((val &&
+ dashboardViewModel.tradeFilterStore.enabledProviders == 0) ||
+ (!val &&
+ dashboardViewModel.tradeFilterStore.enabledProviders > 0)) {
+ dashboardViewModel.tradeFilterStore
+ .toggleDisplayExchange(ExchangeProviderDescription.all);
+ }
+ }),
+ ),
+ ),
+ NewListSections(sections: {
+ "": dashboardViewModel.exchangeFilterItems
+ .whereType()
+ .map((item) => ListItemCheckbox(
+ iconPath: item.providerDescription.image,
+ keyValue: item.caption,
+ label: item.caption,
+ value: item.value(),
+ onChanged: (val) => dashboardViewModel.tradeFilterStore
+ .toggleDisplayExchange(item.providerDescription)))
+ .toList()
+ }),
+ ],
+ ),
+ ),
+ ),
+ ))
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_tile_base.dart b/lib/new-ui/widgets/coins_page/assets_history/history_tile_base.dart
index 44fe3882f..df8e51cd3 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_tile_base.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_tile_base.dart
@@ -87,7 +87,7 @@ class HistoryTileBase extends StatelessWidget {
bottomLeft: Radius.circular(roundedBottom ? 22 : 0),
bottomRight: Radius.circular(roundedBottom ? 22 : 0),
)),
- color: Theme.of(context).colorScheme.onInverseSurface,
+ color: Theme.of(context).colorScheme.surfaceContainer,
),
child: Padding(
padding: const EdgeInsets.symmetric(
@@ -151,7 +151,7 @@ class HistoryTileBase extends StatelessWidget {
),
),
if(bottomSeparator) Container(
- color: Theme.of(context).colorScheme.onInverseSurface,
+ color: Theme.of(context).colorScheme.surfaceContainer,
child: Padding(
padding: EdgeInsets.only(left: 56, right: 16),
child: Container(height: 1, color: Theme.of(context).colorScheme.outlineVariant.withAlpha(175)),
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
new file mode 100644
index 000000000..c8749b731
--- /dev/null
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
@@ -0,0 +1,56 @@
+import 'package:cake_wallet/generated/i18n.dart';
+import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
+import 'package:flutter/material.dart';
+
+class HistoryTopBar extends StatelessWidget {
+ const HistoryTopBar({super.key, required this.onTap});
+
+ final VoidCallback onTap;
+
+ @override
+ Widget build(BuildContext context) {
+ return SliverToBoxAdapter(
+ child: GestureDetector(
+ onTap: onTap,
+ behavior: HitTestBehavior.opaque,
+ child: Padding(
+ padding: const EdgeInsets.only(left: 16, right: 16, top: 24),
+ child: Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(18),
+ ),
+ color: Theme.of(context).colorScheme.surfaceContainer),
+ child: Padding(
+ padding: EdgeInsets.symmetric(
+ horizontal: 12,
+ ),
+ child: Column(
+ spacing: 12,
+ children: [
+ SizedBox.shrink(),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(S.of(context).history),
+ CakeImageWidget(
+ imageUrl: "assets/new-ui/arrow_right.svg",
+ colorFilter: ColorFilter.mode(
+ Theme.of(context).colorScheme.onSurfaceVariant, BlendMode.srcIn),
+ )
+ ],
+ ),
+ Container(
+ height: 1,
+ width: double.infinity,
+ color: Theme.of(context).colorScheme.outlineVariant.withAlpha(175),
+ )
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart b/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart
index aa9b522a5..06bbfd502 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart
@@ -14,6 +14,7 @@ import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
+import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class TransactionDetailsModal extends StatefulWidget {
const TransactionDetailsModal({super.key, required this.transactionDetailsViewModel, this.highlightNoteField = false});
@@ -47,160 +48,153 @@ class _TransactionDetailsModalState extends State {
@override
Widget build(BuildContext context) {
- return DraggableScrollableSheet(
- expand: false,
- initialChildSize: 0.9,
- minChildSize: 0.25,
- maxChildSize: 0.9,
- snap: true,
- snapSizes: const [0.9],
- builder: (context, controller) => SafeArea(
- bottom: false,
- child: Padding(
- padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
- child: GestureDetector(
- onTap: FocusScope.of(context).unfocus,
- child: Container(
- decoration: BoxDecoration(
- color: Theme.of(context).colorScheme.surface,
- borderRadius: BorderRadius.vertical(top: Radius.circular(25))),
+ return SafeArea(
+ bottom: false,
+ child: Padding(
+ padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
+ child: GestureDetector(
+ onTap: FocusScope.of(context).unfocus,
+ child: Container(
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.surface,
+ borderRadius: BorderRadius.vertical(top: Radius.circular(25))),
+ child: Column(
+ children: [
+ ModalTopBar(
+ title: S.of(context).transaction,
+ leadingIcon: Icon(Icons.close),
+ onLeadingPressed: Navigator.of(context).pop,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ controller: ModalScrollController.of(context),
child: Column(
children: [
- ModalTopBar(
- title: S.of(context).transaction,
- leadingIcon: Icon(Icons.close),
- onLeadingPressed: Navigator.of(context).pop,
+ TokenImageWidget(
+ imageUrl: widget
+ .transactionDetailsViewModel.transactionAsset.iconPath ??
+ "",
+ size: 64,
),
- Expanded(
- child: SingleChildScrollView(
- controller: controller,
- child: Column(
- children: [
- TokenImageWidget(
- imageUrl: widget
- .transactionDetailsViewModel.transactionAsset.iconPath ??
- "",
- size: 64,
- ),
- SizedBox(height: 10),
- Text(
- widget.transactionDetailsViewModel.formattedTitle +
- widget.transactionDetailsViewModel.formattedStatus,
- style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
- ),
- CopyWrapper(
- requireLongPress: true,
- data: ClipboardData(text: widget.transactionDetailsViewModel.formattedCryptoAmount),
- builder: (context, copied)=> AnimatedSwitcher(
- duration: Duration(milliseconds: 300),
- child: Text(
- key: ValueKey(copied),
- copied ? S.of(context).copied : widget.transactionDetailsViewModel.formattedCryptoAmount,
- style: TextStyle(fontSize: 28, color: copied ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onSurface),
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(16.0),
+ SizedBox(height: 10),
+ Text(
+ widget.transactionDetailsViewModel.formattedTitle +
+ widget.transactionDetailsViewModel.formattedStatus,
+ style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
+ ),
+ CopyWrapper(
+ requireLongPress: true,
+ data: ClipboardData(text: widget.transactionDetailsViewModel.formattedCryptoAmount),
+ builder: (context, copied)=> AnimatedSwitcher(
+ duration: Duration(milliseconds: 300),
+ child: Text(
+ key: ValueKey(copied),
+ copied ? S.of(context).copied : widget.transactionDetailsViewModel.formattedCryptoAmount,
+ style: TextStyle(fontSize: 28, color: copied ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onSurface),
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ spacing: 12,
+ children: [
+ NewListSections(sections: {
+ "": widget.transactionDetailsViewModel.items
+ .map((item) {
+ if (item.value.isEmpty) return null;
+
+ final shouldBuildBottomWidget =
+ item.value.length > 25;
+
+ return ListItemRegularRow(
+ copyableText: item.value,
+ showArrow: false,
+ keyValue:
+ ((item.key as ValueKey?)?.value as String?) ??
+ item.title,
+ label: item.title,
+ trailingWidget: shouldBuildBottomWidget
+ ? null
+ : _buildTrailingWIdget(item),
+ bottomWidget: shouldBuildBottomWidget
+ ? _buildBottomWidget(item)
+ : null);
+ })
+ .whereType()
+ .toList(),
+ }),
+ Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(20),
+ color: Theme.of(context).colorScheme.surfaceContainer),
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
child: Column(
- spacing: 12,
+ spacing: 8,
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- NewListSections(sections: {
- "": widget.transactionDetailsViewModel.items
- .map((item) {
- if (item.value.isEmpty) return null;
-
- final shouldBuildBottomWidget =
- item.value.length > 25;
-
- return ListItemRegularRow(
- copyableText: item.value,
- showArrow: false,
- keyValue:
- ((item.key as ValueKey?)?.value as String?) ??
- item.title,
- label: item.title,
- trailingWidget: shouldBuildBottomWidget
- ? null
- : _buildTrailingWIdget(item),
- bottomWidget: shouldBuildBottomWidget
- ? _buildBottomWidget(item)
- : null);
- })
- .whereType()
- .toList(),
- }),
- Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
- color: Theme.of(context).colorScheme.surfaceContainer),
- child: Padding(
- padding: const EdgeInsets.all(12.0),
- child: Column(
- spacing: 8,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(S.of(context).note),
- TextField(
- focusNode: noteFocusNode,
- controller: noteController,
- decoration: InputDecoration(
- hintText: S.of(context).add_a_note,
- border: InputBorder.none,
- focusedBorder: InputBorder.none,
- enabledBorder: InputBorder.none,
- contentPadding: EdgeInsets.zero,
- isDense: true),
- )
- ],
- ),
- ),
- ),
- Observer(
- builder: (_) => NewListSections(sections: {
- "view tx": [
- ListItemRegularRow(
- keyValue: "view tx on",
- label: widget.transactionDetailsViewModel
- .explorerDescription,
- onTap: widget
- .transactionDetailsViewModel.launchExplorer,
- foregroundColor:
- Theme.of(context).colorScheme.primary,
- trailingIconPath: "assets/new-ui/link_arrow.svg",
- trailingIconSize: 8)
- ],
- if (widget.transactionDetailsViewModel.canReplaceByFee)
- "rbf": [
- ListItemRegularRow(
- keyValue: "replace by fee",
- label: S.of(context).bump_fee,
- onTap: () {
- Navigator.of(context)
- .pushNamed(Routes.bumpFeePage, arguments: [
- widget.transactionDetailsViewModel
- .transactionInfo,
- widget.transactionDetailsViewModel
- .rawTransaction
- ]);
- })
- ]
- }),
+ Text(S.of(context).note),
+ TextField(
+ focusNode: noteFocusNode,
+ controller: noteController,
+ decoration: InputDecoration(
+ hintText: S.of(context).add_a_note,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ contentPadding: EdgeInsets.zero,
+ isDense: true),
)
],
),
),
- SizedBox(height: MediaQuery.of(context).viewPadding.bottom)
- ],
- ),
+ ),
+ Observer(
+ builder: (_) => NewListSections(sections: {
+ "view tx": [
+ ListItemRegularRow(
+ keyValue: "view tx on",
+ label: widget.transactionDetailsViewModel
+ .explorerDescription,
+ onTap: widget
+ .transactionDetailsViewModel.launchExplorer,
+ foregroundColor:
+ Theme.of(context).colorScheme.primary,
+ trailingIconPath: "assets/new-ui/link_arrow.svg",
+ trailingIconSize: 8)
+ ],
+ if (widget.transactionDetailsViewModel.canReplaceByFee)
+ "rbf": [
+ ListItemRegularRow(
+ keyValue: "replace by fee",
+ label: S.of(context).bump_fee,
+ onTap: () {
+ Navigator.of(context)
+ .pushNamed(Routes.bumpFeePage, arguments: [
+ widget.transactionDetailsViewModel
+ .transactionInfo,
+ widget.transactionDetailsViewModel
+ .rawTransaction
+ ]);
+ })
+ ]
+ }),
+ )
+ ],
),
- )
+ ),
+ SizedBox(height: MediaQuery.of(context).viewPadding.bottom)
],
),
),
- ),
- ),
- ));
+ )
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
}
Widget _buildTrailingWIdget(TransactionDetailsListItem item) {
diff --git a/lib/new-ui/widgets/select_deselect_all.dart b/lib/new-ui/widgets/select_deselect_all.dart
new file mode 100644
index 000000000..ca6711ed5
--- /dev/null
+++ b/lib/new-ui/widgets/select_deselect_all.dart
@@ -0,0 +1,39 @@
+import 'package:cake_wallet/generated/i18n.dart';
+import 'package:flutter/material.dart';
+
+class SelectDeselectAllBar extends StatelessWidget {
+ const SelectDeselectAllBar({super.key, required this.title, required this.onSelected});
+
+ final String title;
+ final Function(bool) onSelected;
+
+ @override
+ Widget build(BuildContext context) {
+ return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ color: Theme.of(context).colorScheme.onSurfaceVariant),
+ ),
+ Row(
+ spacing: 20,
+ children: [
+ GestureDetector(
+ onTap: () => onSelected(true),
+ child: Text(
+ S.of(context).select_all,
+ style: TextStyle(color: Theme.of(context).colorScheme.primary),
+ ),
+ ),
+ GestureDetector(
+ onTap: () => onSelected(false),
+ child: Text(S.of(context).unselect_all,
+ style: TextStyle(color: Theme.of(context).colorScheme.primary)),
+ )
+ ],
+ )
+ ]);
+ }
+}
diff --git a/lib/router.dart b/lib/router.dart
index 638329ae8..bd1d5ad0f 100644
--- a/lib/router.dart
+++ b/lib/router.dart
@@ -679,7 +679,7 @@ Route createRoute(RouteSettings settings) {
return MaterialPageRoute(builder: (_) => getIt.get());
case Routes.tradeDetails:
- return MaterialPageRoute(
+ return CupertinoPageRoute(
fullscreenDialog: true,
builder: (_) => getIt.get(param1: settings.arguments as Trade));
diff --git a/lib/src/screens/dashboard/widgets/header_row.dart b/lib/src/screens/dashboard/widgets/header_row.dart
index 5b89c0e8f..c8d7c86c7 100644
--- a/lib/src/screens/dashboard/widgets/header_row.dart
+++ b/lib/src/screens/dashboard/widgets/header_row.dart
@@ -62,11 +62,6 @@ class HeaderRow extends StatelessWidget {
child: GestureDetector(
key: ValueKey('transactions_page_header_row_transaction_filter_button_key'),
onTap: () {
- showPopUp(
- context: context,
- builder: (context) =>
- FilterWidget(filterItems: dashboardViewModel.filterItems),
- );
},
child: Semantics(
label: 'Transaction Filter',
diff --git a/lib/src/widgets/new_list_row/list_item_checkbox_widget.dart b/lib/src/widgets/new_list_row/list_item_checkbox_widget.dart
index 823328723..a2a75d552 100644
--- a/lib/src/widgets/new_list_row/list_item_checkbox_widget.dart
+++ b/lib/src/widgets/new_list_row/list_item_checkbox_widget.dart
@@ -11,6 +11,7 @@ class ListItemCheckboxWidget extends StatefulWidget {
required this.label,
required this.value,
required this.onChanged,
+ this.subtitleColor,
this.onTap,
this.isFirstInSection = false,
this.isLastInSection = false, this.subtitle, this.iconPath, this.showArrow = false,
@@ -22,6 +23,7 @@ class ListItemCheckboxWidget extends StatefulWidget {
final String? iconPath;
final bool showArrow;
final bool value;
+ final Color? subtitleColor;
final VoidCallback? onTap;
final ValueChanged onChanged;
final bool isFirstInSection;
@@ -81,7 +83,7 @@ class _ListItemCheckboxWidgetState extends State {
Text(
widget.subtitle!,
style: TextStyle(
- fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant),
+ fontSize: 12, color: widget.subtitleColor ?? Theme.of(context).colorScheme.onSurfaceVariant),
)
],
),
diff --git a/lib/src/widgets/new_list_row/new_list_section.dart b/lib/src/widgets/new_list_row/new_list_section.dart
index 8abef379d..ad78013c8 100644
--- a/lib/src/widgets/new_list_row/new_list_section.dart
+++ b/lib/src/widgets/new_list_row/new_list_section.dart
@@ -133,6 +133,7 @@ class NewListSections extends StatelessWidget {
label: item.label,
subtitle: item.subtitle,
iconPath: item.iconPath,
+ subtitleColor: item.subtitleColor,
showArrow: item.showArrow,
onTap: item.onTap,
value: item.value,
diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart
index 345a37b6c..abc4c337a 100644
--- a/lib/store/dashboard/trade_filter_store.dart
+++ b/lib/store/dashboard/trade_filter_store.dart
@@ -69,6 +69,25 @@ abstract class TradeFilterStoreBase with Store {
@observable
bool displayNearIntents;
+ @computed
+ int get enabledProviders => [
+ displayXMRTO,
+ displayChangeNow,
+ displaySideShift,
+ displayMorphToken,
+ displaySimpleSwap,
+ displayTrocador,
+ displayExolix,
+ displayChainflip,
+ displayThorChain,
+ displayLetsExchange,
+ displayStealthEx,
+ displayXOSwap,
+ displaySwapTrade,
+ displaySwapXyz,
+ displayNearIntents
+ ].where((item) => item).length;
+
@computed
bool get displayAllTrades =>
displayChangeNow &&
diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart
index 1a2e476e0..02c373f0a 100644
--- a/lib/view_model/dashboard/dashboard_view_model.dart
+++ b/lib/view_model/dashboard/dashboard_view_model.dart
@@ -96,111 +96,104 @@ abstract class DashboardViewModelBase with Store {
isShowFirstYatIntroduction = false,
isShowSecondYatIntroduction = false,
isShowThirdYatIntroduction = false,
- filterItems = {
- S.current.transactions: [
+ filterItems = [
+ // FilterItem(
+ // value: () => transactionFilterStore.displayAll,
+ // caption: S.current.all_transactions,
+ // onChanged: transactionFilterStore.toggleAll),
+ FilterItem(
+ value: () => transactionFilterStore.displayIncoming,
+ caption: S.current.send,
+ onChanged: transactionFilterStore.toggleIncoming),
+ FilterItem(
+ value: () => transactionFilterStore.displayOutgoing,
+ caption: S.current.receive,
+ onChanged: transactionFilterStore.toggleOutgoing),
+ if (appStore.wallet!.type == WalletType.bitcoin)
FilterItem(
- value: () => transactionFilterStore.displayAll,
- caption: S.current.all_transactions,
- onChanged: transactionFilterStore.toggleAll),
- FilterItem(
- value: () => transactionFilterStore.displayIncoming,
- caption: S.current.incoming,
- onChanged: transactionFilterStore.toggleIncoming),
- FilterItem(
- value: () => transactionFilterStore.displayOutgoing,
- caption: S.current.outgoing,
- onChanged: transactionFilterStore.toggleOutgoing),
- if (appStore.wallet!.type == WalletType.bitcoin)
- FilterItem(
- value: () => transactionFilterStore.displaySilentPayments,
- caption: S.current.silent_payments,
- onChanged: transactionFilterStore.toggleSilentPayments,
- ),
- // FilterItem(
- // value: () => false,
- // caption: S.current.transactions_by_date,
- // onChanged: null),
- ],
- 'Orders': [
- FilterItem(
- value: () => orderFilterStore.displayCakePay,
- caption: 'Cake Pay',
- onChanged: () =>
- orderFilterStore.toggleDisplayOrder(OrderProviderDescription.cakePay)),
- ],
- S.current.trades: [
- FilterItem(
- value: () => tradeFilterStore.displayAllTrades,
- caption: S.current.all_trades,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
- FilterItem(
- value: () => tradeFilterStore.displayChangeNow,
- caption: ExchangeProviderDescription.changeNow.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
- FilterItem(
- value: () => tradeFilterStore.displaySideShift,
- caption: ExchangeProviderDescription.sideShift.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
- FilterItem(
- value: () => tradeFilterStore.displaySimpleSwap,
- caption: ExchangeProviderDescription.simpleSwap.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
- FilterItem(
- value: () => tradeFilterStore.displayTrocador,
- caption: ExchangeProviderDescription.trocador.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
- FilterItem(
- value: () => tradeFilterStore.displayExolix,
- caption: ExchangeProviderDescription.exolix.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
- FilterItem(
- value: () => tradeFilterStore.displayChainflip,
- caption: ExchangeProviderDescription.chainflip.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.chainflip)),
- FilterItem(
- value: () => tradeFilterStore.displayThorChain,
- caption: ExchangeProviderDescription.thorChain.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.thorChain)),
- FilterItem(
- value: () => tradeFilterStore.displayLetsExchange,
- caption: ExchangeProviderDescription.letsExchange.title,
- onChanged: () => tradeFilterStore
- .toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
- FilterItem(
- value: () => tradeFilterStore.displayStealthEx,
- caption: ExchangeProviderDescription.stealthEx.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)),
- FilterItem(
- value: () => tradeFilterStore.displayXOSwap,
- caption: ExchangeProviderDescription.xoSwap.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.xoSwap)),
- FilterItem(
- value: () => tradeFilterStore.displaySwapTrade,
- caption: ExchangeProviderDescription.swapTrade.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
- FilterItem(
- value: () => tradeFilterStore.displaySwapXyz,
- caption: ExchangeProviderDescription.swapsXyz.title,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
- FilterItem(
- value: () => tradeFilterStore.displayNearIntents,
- caption: ExchangeProviderDescription.nearIntents.title,
- onChanged: () => tradeFilterStore
- .toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
- ]
- },
+ value: () => transactionFilterStore.displaySilentPayments,
+ caption: S.current.silent_payments,
+ onChanged: transactionFilterStore.toggleSilentPayments,
+ ),
+ SwapFilterItem(
+ enabledProviders: () => tradeFilterStore.enabledProviders,
+ allEnabled: () => tradeFilterStore.displayAllTrades,
+ value: () => tradeFilterStore.displayAllTrades,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
+ FilterItem(
+ value: () => orderFilterStore.displayCakePay,
+ caption: 'Cake Pay',
+ onChanged: () =>
+ orderFilterStore.toggleDisplayOrder(OrderProviderDescription.cakePay)),
+ ],
+ exchangeFilterItems = [
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.changeNow,
+ value: () => tradeFilterStore.displayChangeNow,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.sideShift,
+ value: () => tradeFilterStore.displaySideShift,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.simpleSwap,
+ value: () => tradeFilterStore.displaySimpleSwap,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.trocador,
+ value: () => tradeFilterStore.displayTrocador,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.exolix,
+ value: () => tradeFilterStore.displayExolix,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.chainflip,
+ value: () => tradeFilterStore.displayChainflip,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.chainflip)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.thorChain,
+ value: () => tradeFilterStore.displayThorChain,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.thorChain)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.letsExchange,
+ value: () => tradeFilterStore.displayLetsExchange,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.stealthEx,
+ value: () => tradeFilterStore.displayStealthEx,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.xoSwap,
+ value: () => tradeFilterStore.displayXOSwap,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.xoSwap)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.swapTrade,
+ value: () => tradeFilterStore.displaySwapTrade,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.swapsXyz,
+ value: () => tradeFilterStore.displaySwapXyz,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.nearIntents,
+ value: () => tradeFilterStore.displayNearIntents,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
+ ],
subname = '',
name = appStore.wallet!.name,
type = appStore.wallet!.type,
@@ -406,6 +399,15 @@ abstract class DashboardViewModelBase with Store {
return false;
}
+ @action
+ void changeAllFilterItems(bool value) {
+ for (final item in filterItems) {
+ if (item.value() != value) {
+ item.onChanged();
+ }
+ }
+ }
+
@action
Future loadCardDesigns() async {
final accountStyleSettings =
@@ -719,7 +721,10 @@ abstract class DashboardViewModelBase with Store {
static const shortHistoryLength = 3;
@computed
- List get itemsShort => items.where((item)=>item is! DateSectionItem).take(3).toList();
+ List get itemsShort => items
+ .where((item) => item is! DateSectionItem)
+ .take(shortHistoryLength)
+ .toList();
@observable
WalletBase, TransactionInfo> wallet;
@@ -1129,7 +1134,11 @@ abstract class DashboardViewModelBase with Store {
PayjoinTransactionsStore payjoinTransactionsStore;
- Map> filterItems;
+ // Map> filterItems;
+
+ List filterItems;
+
+ List exchangeFilterItems;
bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled;
diff --git a/lib/view_model/dashboard/date_section_item.dart b/lib/view_model/dashboard/date_section_item.dart
index 75250a7ea..5bc607dcf 100644
--- a/lib/view_model/dashboard/date_section_item.dart
+++ b/lib/view_model/dashboard/date_section_item.dart
@@ -1,8 +1,36 @@
+import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
class DateSectionItem extends ActionListItem {
DateSectionItem(this.date, {required super.key});
-
+
@override
final DateTime date;
-}
\ No newline at end of file
+}
+
+abstract class SpecificDateSectionItem extends DateSectionItem {
+ SpecificDateSectionItem(super.date, {required super.key});
+
+ String get text;
+}
+
+class Last30daysTransactionItem extends SpecificDateSectionItem {
+ Last30daysTransactionItem(super.date, {required super.key});
+
+ @override
+ String get text => S.current.last_30_days;
+}
+
+class Last7daysTransactionItem extends SpecificDateSectionItem {
+ Last7daysTransactionItem(super.date, {required super.key});
+
+ @override
+ String get text => S.current.last_7_days;
+}
+
+class TodayTransactionItem extends SpecificDateSectionItem {
+ TodayTransactionItem(super.date, {required super.key});
+
+ @override
+ String get text => S.current.today;
+}
diff --git a/lib/view_model/dashboard/filter_item.dart b/lib/view_model/dashboard/filter_item.dart
index 0944e899c..ffd0a35a3 100644
--- a/lib/view_model/dashboard/filter_item.dart
+++ b/lib/view_model/dashboard/filter_item.dart
@@ -1,4 +1,4 @@
-import 'package:mobx/mobx.dart';
+import 'package:cake_wallet/exchange/exchange_provider_description.dart';
class FilterItem {
FilterItem({
@@ -9,4 +9,32 @@ class FilterItem {
bool Function() value;
String caption;
Function onChanged;
+}
+
+class SwapFilterItem extends FilterItem {
+ SwapFilterItem({
+ required this.enabledProviders,
+ required this.allEnabled,
+ required super.value,
+ super.caption = "Swap",
+ required super.onChanged,
+ });
+
+ int Function() enabledProviders;
+ bool Function() allEnabled;
+}
+
+
+class SwapProviderFilterItem extends FilterItem {
+ SwapProviderFilterItem({
+ required super.value,
+ required super.onChanged,
+ required this.providerDescription,
+ super.caption = ""
+});
+
+ @override
+ String get caption => providerDescription.title;
+
+ final ExchangeProviderDescription providerDescription;
}
\ No newline at end of file
diff --git a/lib/view_model/dashboard/formatted_item_list.dart b/lib/view_model/dashboard/formatted_item_list.dart
index 04464ca89..2348222c5 100644
--- a/lib/view_model/dashboard/formatted_item_list.dart
+++ b/lib/view_model/dashboard/formatted_item_list.dart
@@ -1,45 +1,82 @@
-import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
-import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
-import 'package:flutter/foundation.dart';
+import "package:cake_wallet/view_model/dashboard/action_list_item.dart";
+import "package:cake_wallet/view_model/dashboard/date_section_item.dart";
+import "package:flutter/foundation.dart";
+
+enum _DateBucket { recent, last7Days, last30Days, byMonth }
List formattedItemsList(List items) {
final formattedList = [];
- DateTime? lastDate;
items.sort((a, b) => b.date.compareTo(a.date));
- for (var i = 0; i < items.length; i++) {
- final transaction = items[i];
+ final now = DateTime.now();
+ final last24hThreshold = now.subtract(const Duration(hours: 24));
+ final last7daysThreshold = now.subtract(const Duration(days: 7));
+ final last30daysThreshold = now.subtract(const Duration(days: 30));
- if (lastDate == null) {
- lastDate = transaction.date;
- formattedList.add(
- DateSectionItem(
- transaction.date,
- key: ValueKey('date_section_item_${transaction.date.microsecondsSinceEpoch}_key'),
- ),
- );
- formattedList.add(transaction);
- continue;
+ _DateBucket? lastBucket;
+ DateTime? lastMonthDate;
+
+ for (final transaction in items) {
+ final date = transaction.date;
+
+ final bucket = date.isAfter(last24hThreshold)
+ ? _DateBucket.recent
+ : date.isAfter(last7daysThreshold)
+ ? _DateBucket.last7Days
+ : date.isAfter(last30daysThreshold)
+ ? _DateBucket.last30Days
+ : _DateBucket.byMonth;
+
+ switch (bucket) {
+ case _DateBucket.recent:
+ if (lastBucket != _DateBucket.recent) {
+ formattedList.add(
+ TodayTransactionItem(
+ date,
+ key: const ValueKey("last_7_days_section_item_key"),
+ ),
+ );
+ }
+ break;
+ case _DateBucket.last7Days:
+ if (lastBucket != _DateBucket.last7Days) {
+ formattedList.add(
+ Last7daysTransactionItem(
+ date,
+ key: const ValueKey("last_7_days_section_item_key"),
+ ),
+ );
+ }
+ break;
+ case _DateBucket.last30Days:
+ if (lastBucket != _DateBucket.last30Days) {
+ formattedList.add(
+ Last30daysTransactionItem(
+ date,
+ key: const ValueKey("last_30_days_section_item_key"),
+ ),
+ );
+ }
+ break;
+ case _DateBucket.byMonth:
+ final isNewMonth = lastMonthDate == null ||
+ lastMonthDate.year != date.year ||
+ lastMonthDate.month != date.month;
+ if (isNewMonth) {
+ lastMonthDate = date;
+ formattedList.add(
+ DateSectionItem(
+ date,
+ key: ValueKey("date_section_item_${date.year}_${date.month}_key"),
+ ),
+ );
+ }
+ break;
}
- final isCurrentDay = lastDate.year == transaction.date.year &&
- lastDate.month == transaction.date.month &&
- lastDate.day == transaction.date.day;
-
- if (isCurrentDay) {
- formattedList.add(transaction);
- continue;
- }
-
- lastDate = transaction.date;
- formattedList.add(
- DateSectionItem(
- transaction.date,
- key: ValueKey('date_section_item_${transaction.date.microsecondsSinceEpoch}_key'),
- ),
- );
+ lastBucket = bucket;
formattedList.add(transaction);
}
return formattedList;
-}
\ No newline at end of file
+}
diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb
index b7f1832fd..19a6820ea 100644
--- a/res/values/strings_en.arb
+++ b/res/values/strings_en.arb
@@ -53,6 +53,7 @@
"alert_notice": "Notice",
"all": "ALL",
"all_coins": "All Coins",
+ "all_pascal_case": "All",
"all_trades": "All trades",
"all_transactions": "All transactions",
"alphabetical": "Alphabetical",
@@ -487,6 +488,7 @@
"file_saved": "File saved",
"fill_code": "Please fill in the verification code provided to your email",
"filter_by": "Filter by",
+ "filter_swap_providers": "Filter Swap Providers",
"filters": "Filters",
"finding_provider": "Finding provider",
"first_wallet_text": "Awesome wallet for Monero, Bitcoin, Ethereum, Litecoin, and Haven",
@@ -568,6 +570,7 @@
"label": "Label",
"label_address": "Label address",
"last_30_days": "Last 30 days",
+ "last_7_days": "Last 7 days",
"learn_more": "Learn More",
"ledger_connection_error": "Failed to connect to your Ledger. Please try again.",
"ledger_error_device_locked": "The Ledger is locked",
@@ -682,6 +685,7 @@
"no_id_needed": "No ID needed!",
"no_id_required": "No ID required. Top up and spend anywhere",
"no_providers_available": "No providers available",
+ "no_providers_selected": "No Providers Selected",
"no_relay_on_domain": "There isn't a relay for user's domain or the relay is unavailable. Please choose a relay to use.",
"no_relays": "No relays",
"no_relays_message": "We found a Nostr NIP-05 record for this user, but it does not contain any relays. Please instruct the recipient to add relays to their Nostr record.",
@@ -871,6 +875,7 @@
"rescan": "Rescan",
"resend_code": "Please resend it",
"reset": "Reset",
+ "reset_filters": "Reset Filters",
"reset_password": "Reset Password",
"restore": "Restore",
"restore_active_seed": "Active seed",
@@ -1285,6 +1290,7 @@
"tx_wrong_balance_exception": "You do not have enough ${currency} to send this amount.",
"tx_wrong_balance_with_amount_exception": "You do not have enough ${currency} to send the total amount of ${amount}",
"tx_zero_fee_exception": "Cannot send transaction with 0 fee. Try increasing the rate or checking your connection for latest estimates.",
+ "type": "Type",
"unavailable_balance": "Unavailable balance",
"unavailable_balance_description": "Unavailable Balance: This total includes funds that are locked in pending transactions and those you have actively frozen in your Coin Control settings. Locked balances will become available once their respective transactions are completed, while frozen balances remain inaccessible for transactions until you decide to unfreeze them.",
"unconfirmed": "Unconfirmed Balance",
From f7d80c62a24e96cfe3d4aba364f259f3d03959a8 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 10:36:57 +0200
Subject: [PATCH 03/48] fix send/receive
---
.../dashboard/dashboard_view_model.dart | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart
index 02c373f0a..bb34a1345 100644
--- a/lib/view_model/dashboard/dashboard_view_model.dart
+++ b/lib/view_model/dashboard/dashboard_view_model.dart
@@ -101,14 +101,14 @@ abstract class DashboardViewModelBase with Store {
// value: () => transactionFilterStore.displayAll,
// caption: S.current.all_transactions,
// onChanged: transactionFilterStore.toggleAll),
- FilterItem(
- value: () => transactionFilterStore.displayIncoming,
- caption: S.current.send,
- onChanged: transactionFilterStore.toggleIncoming),
FilterItem(
value: () => transactionFilterStore.displayOutgoing,
- caption: S.current.receive,
+ caption: S.current.send,
onChanged: transactionFilterStore.toggleOutgoing),
+ FilterItem(
+ value: () => transactionFilterStore.displayIncoming,
+ caption: S.current.receive,
+ onChanged: transactionFilterStore.toggleIncoming),
if (appStore.wallet!.type == WalletType.bitcoin)
FilterItem(
value: () => transactionFilterStore.displaySilentPayments,
@@ -118,7 +118,7 @@ abstract class DashboardViewModelBase with Store {
SwapFilterItem(
enabledProviders: () => tradeFilterStore.enabledProviders,
allEnabled: () => tradeFilterStore.displayAllTrades,
- value: () => tradeFilterStore.displayAllTrades,
+ value: () => tradeFilterStore.enabledProviders>0,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
FilterItem(
@@ -406,6 +406,11 @@ abstract class DashboardViewModelBase with Store {
item.onChanged();
}
}
+ for (final item in exchangeFilterItems) {
+ if (item.value() != value) {
+ item.onChanged();
+ }
+ }
}
@action
From 681009679512345bab11fff69bae475ab2d242f8 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 10:37:08 +0200
Subject: [PATCH 04/48] fix today threshold
---
lib/view_model/dashboard/formatted_item_list.dart | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/view_model/dashboard/formatted_item_list.dart b/lib/view_model/dashboard/formatted_item_list.dart
index 2348222c5..45dfb663d 100644
--- a/lib/view_model/dashboard/formatted_item_list.dart
+++ b/lib/view_model/dashboard/formatted_item_list.dart
@@ -9,7 +9,7 @@ List formattedItemsList(List items) {
items.sort((a, b) => b.date.compareTo(a.date));
final now = DateTime.now();
- final last24hThreshold = now.subtract(const Duration(hours: 24));
+ final todayTreshold = DateTime(now.year, now.month, now.day);
final last7daysThreshold = now.subtract(const Duration(days: 7));
final last30daysThreshold = now.subtract(const Duration(days: 30));
@@ -19,7 +19,7 @@ List formattedItemsList(List items) {
for (final transaction in items) {
final date = transaction.date;
- final bucket = date.isAfter(last24hThreshold)
+ final bucket = date.isAfter(todayTreshold)
? _DateBucket.recent
: date.isAfter(last7daysThreshold)
? _DateBucket.last7Days
@@ -33,7 +33,7 @@ List formattedItemsList(List items) {
formattedList.add(
TodayTransactionItem(
date,
- key: const ValueKey("last_7_days_section_item_key"),
+ key: const ValueKey("today_section_item_key"),
),
);
}
From ba0be28da81fe1cf43090d1b375dddb3bac67d67 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 10:37:16 +0200
Subject: [PATCH 05/48] fix swap filter checkbox
---
.../widgets/coins_page/assets_history/history_filters_page.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart b/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart
index 3a71a86cb..072f11015 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_filters_page.dart
@@ -52,7 +52,7 @@ class HistoryFiltersPage extends StatelessWidget {
if (item is SwapFilterItem) {
final String subtitle;
final Color subtitleColor;
- if (item.value()) {
+ if (dashboardViewModel.tradeFilterStore.displayAllTrades) {
subtitle = S.of(context).manage_providers;
subtitleColor = Theme.of(context).colorScheme.onSurfaceVariant;
} else if (dashboardViewModel.tradeFilterStore.enabledProviders == 0) {
From 52b014aac2d44c359f5e6a8be649db972faf3905 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 10:37:28 +0200
Subject: [PATCH 06/48] add border around filters button
---
.../widgets/coins_page/assets_history/history_modal.dart | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart b/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart
index 9b93a9d0c..864c7fec6 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_modal.dart
@@ -86,7 +86,11 @@ class HistoryModal extends StatelessWidget {
},
child: Material(
color: Colors.transparent,
- child: SizedBox(
+ child: Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(18),
+ border: Border.all(color: Theme.of(context).colorScheme.primary, width: 1)
+ ),
height: 56,
width: double.infinity,
child: Row(
From 117f8e922a8506f14e6a236147814a4c24edc2a9 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 10:37:51 +0200
Subject: [PATCH 07/48] fix observer for history section
---
.../assets_history/history_section.dart | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
index fd2e08145..bb2016b5b 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
@@ -34,12 +34,14 @@ class HistorySection extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
return SliverPadding(
padding: EdgeInsets.only(left: 16.0, right: 16, top: short && roundedTopSection ? 18 : 0),
sliver: Observer(
- builder: (_) => (items.isEmpty)
+ builder: (_) {
+ final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
+
+ return (items.isEmpty)
? SliverPadding(
padding: EdgeInsets.only(top: 24),
sliver: SliverToBoxAdapter(
@@ -203,7 +205,8 @@ class HistorySection extends StatelessWidget {
return Text(item.runtimeType.toString());
}),
),
- ),
+ );
+ },
));
}
@@ -237,15 +240,15 @@ class HistorySection extends StatelessWidget {
if (daysAgo < 7) {
final weekday = DateFormat.EEEE().format(date);
- return '$weekday, $timeStr';
+ return "$weekday, $timeStr";
}
if (date.year == now.year) {
final dayMonth = DateFormat("d MMMM").format(date);
- return '$dayMonth, $timeStr';
+ return "$dayMonth, $timeStr";
}
- final full = DateFormat("d MMMM yyyy").format(date);
- return '$full, $timeStr';
+ final full = DateFormat("d MMM yyyy").format(date);
+ return "$full, $timeStr";
}
}
From eff46638d9ba26b9bf3b4decb6da71bf143332c4 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 26 Jun 2026 13:25:55 +0200
Subject: [PATCH 08/48] locale fix
---
.../assets_history_section.dart | 35 ++++++++---
.../assets_history/assets_top_bar.dart | 58 ++++---------------
.../assets_history/history_section.dart | 24 ++++----
3 files changed, 48 insertions(+), 69 deletions(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index ecc163092..81fad913d 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -4,6 +4,7 @@ import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/assets_top_
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_modal.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_top_bar.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart';
+import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/dashboard/pages/nft_listing_page.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
@@ -13,11 +14,20 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'assets_section.dart';
import 'history_section.dart';
+class AssetsHistorySectionActionButton {
+ final String title;
+ final String iconPath;
+ final VoidCallback onPressed;
+
+ const AssetsHistorySectionActionButton(this.title, this.iconPath, this.onPressed);
+}
+
class AssetsHistorySectionTab {
final String title;
final Widget content;
+ final AssetsHistorySectionActionButton? actionButton;
- AssetsHistorySectionTab(this.title, this.content);
+ const AssetsHistorySectionTab(this.title, this.content, this.actionButton);
}
class AssetsHistorySection extends StatefulWidget {
@@ -36,24 +46,31 @@ class _AssetsHistorySectionState extends State {
void reloadTabs() {
final oldTabLength = tabs.length;
+ final hasAssetsTab = widget.dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled || (widget.dashboardViewModel.hasMweb && widget.dashboardViewModel.mwebEnabled);
+ final hasNftTab = isNFTACtivatedChain(widget.dashboardViewModel.wallet.type,
+ chainId: widget.dashboardViewModel.wallet.chainId);
tabs = [
- if (widget.dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled || (widget.dashboardViewModel.hasMweb && widget.dashboardViewModel.mwebEnabled))
+ if (hasAssetsTab)
AssetsHistorySectionTab(
S.current.assets,
AssetsSection(
dashboardViewModel: widget.dashboardViewModel,
- )),
+ ), AssetsHistorySectionActionButton(S.current.tokens, "assets/new-ui/options_slider.svg", (){
+ Navigator.of(context).pushNamed(
+ Routes.homeSettings,
+ arguments: widget.dashboardViewModel.balanceViewModel,
+ );
+ })),
AssetsHistorySectionTab(
S.current.history,
HistorySection(
detailsAsPage: false,
- roundedTopSection: tabs.length > 1,
+ roundedTopSection: hasAssetsTab || hasNftTab,
dashboardViewModel: widget.dashboardViewModel,
short: true,
- )),
- if (isNFTACtivatedChain(widget.dashboardViewModel.wallet.type,
- chainId: widget.dashboardViewModel.wallet.chainId))
- AssetsHistorySectionTab(S.current.nfts, NFTListingPage(nftViewModel: widget.nftViewModel))
+ ), AssetsHistorySectionActionButton(S.current.all_pascal_case, "assets/new-ui/arrow_right.svg", (){openHistoryModal(context);})),
+ if (hasNftTab)
+ AssetsHistorySectionTab(S.current.nfts, NFTListingPage(nftViewModel: widget.nftViewModel), null)
];
if (oldTabLength != tabs.length) {
setState(() {
@@ -81,7 +98,7 @@ class _AssetsHistorySectionState extends State {
AssetsTopBar(
onTransactionHistoryOpened: () => openHistoryModal(context),
dashboardViewModel: widget.dashboardViewModel,
- tabs: tabs.map((item) => item.title).toList(),
+ tabs: tabs,
onTabChange: (index) {
setState(() {
_selectedTab = index;
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart
index a99e8f137..67fe4c9a3 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart
@@ -1,9 +1,5 @@
-import 'package:cake_wallet/core/csv_export_service.dart';
-import 'package:cake_wallet/generated/i18n.dart';
+import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/assets_history_section.dart';
import 'package:cake_wallet/new-ui/widgets/line_tab_switcher.dart';
-import 'package:cake_wallet/routes.dart';
-import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
-import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/material.dart';
@@ -20,13 +16,11 @@ class AssetsTopBar extends StatelessWidget {
final void Function(int) onTabChange;
final VoidCallback onTransactionHistoryOpened;
final int selectedTab;
- final List tabs;
+ final List tabs;
final DashboardViewModel dashboardViewModel;
@override
Widget build(BuildContext context) {
- final settingsButtonText = _getSettingsButtonText();
- final hasTokenSettingsButton = settingsButtonText != null;
return SliverToBoxAdapter(
child: Padding(
@@ -36,7 +30,7 @@ class AssetsTopBar extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LineTabSwitcher(
- tabs: tabs,
+ tabs: tabs.map((item)=>item.title).toList(),
onTabChange: onTabChange,
selectedTab: selectedTab,
),
@@ -57,19 +51,13 @@ class AssetsTopBar extends StatelessWidget {
children: [
Opacity(
- opacity: hasTokenSettingsButton ? 1 : 0,
+ opacity: tabs[selectedTab].actionButton != null ? 1 : 0,
child: GestureDetector(
onTap: () {
- if (tabs[selectedTab] == S.of(context).assets) {
- Navigator.of(context).pushNamed(
- Routes.homeSettings,
- arguments: dashboardViewModel.balanceViewModel,
- );
- } else if (tabs[selectedTab] == S.of(context).history) {
-
- onTransactionHistoryOpened();
- }
- },
+ if(tabs[selectedTab].actionButton != null) {
+ tabs[selectedTab].actionButton?.onPressed();
+ }
+ },
child: Container(
height: 40,
decoration: BoxDecoration(
@@ -82,13 +70,13 @@ class AssetsTopBar extends StatelessWidget {
spacing: 6,
children: [
- if ((settingsButtonText ?? "").isNotEmpty)
+ if ((tabs[selectedTab].actionButton?.title ?? "").isNotEmpty)
Text(
- settingsButtonText ?? "",
+ tabs[selectedTab].actionButton?.title ?? "",
style: TextStyle(color: Theme.of(context).colorScheme.primary),
),
CakeImageWidget(
- imageUrl: _getSettingsButtonIconPath(),
+ imageUrl: tabs[selectedTab].actionButton?.iconPath,
colorFilter: ColorFilter.mode(
Theme.of(context).colorScheme.primary, BlendMode.srcIn)),
],
@@ -106,28 +94,4 @@ class AssetsTopBar extends StatelessWidget {
);
}
- String? _getSettingsButtonIconPath() {
- if (tabs[selectedTab] == S.current.history) {
- return "assets/new-ui/arrow_right.svg";
- }
-
- if (tabs[selectedTab] == S.current.assets &&
- dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled) {
- return "assets/new-ui/options_slider.svg";
- }
-
- return null;
- }
-
- String? _getSettingsButtonText() {
- if (tabs[selectedTab] == S.current.assets &&
- dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled) {
- return S.current.tokens;
- }
-
- if (tabs[selectedTab] == S.current.history) {
- return S.current.all_pascal_case;
- }
- return null;
- }
}
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
index bb2016b5b..56b07cab3 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
@@ -1,5 +1,3 @@
-import 'dart:math';
-
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/anonpay_history_tile.dart';
@@ -9,7 +7,6 @@ import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_tra
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/payjoin_history_tile.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart';
import 'package:cake_wallet/routes.dart';
-import 'package:cake_wallet/utils/date_formatter.dart';
import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
@@ -39,6 +36,7 @@ class HistorySection extends StatelessWidget {
padding: EdgeInsets.only(left: 16.0, right: 16, top: short && roundedTopSection ? 18 : 0),
sliver: Observer(
builder: (_) {
+ final localeName = Localizations.localeOf(context).toString();
final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
return (items.isEmpty)
@@ -100,7 +98,7 @@ class HistorySection extends StatelessWidget {
},
child: HistoryTile(
title: item.formattedTitle + transactionType,
- date: _formatTransactionDate(item.date),
+ date: _formatTransactionDate(item.date, localeName),
amount: item.formattedCryptoAmount,
amountFiat: item.formattedFiatAmount,
hasTokens: item.hasTokens,
@@ -128,7 +126,7 @@ class HistorySection extends StatelessWidget {
from: tradeFrom,
to: tradeTo,
provider: trade.provider,
- date: _formatTransactionDate(item.trade.createdAt ?? DateTime.now()),
+ date: _formatTransactionDate(item.trade.createdAt ?? DateTime.now(), localeName),
amount: trade.amountFormatted(),
receiveAmount: trade.receiveAmountFormatted(),
roundedBottom: roundedBottom,
@@ -154,7 +152,7 @@ class HistorySection extends StatelessWidget {
onTap: () => Navigator.of(context)
.pushNamed(Routes.orderDetails, arguments: item.order),
child: HistoryOrderTile(
- date: _formatTransactionDate(item.order.createdAt),
+ date: _formatTransactionDate(item.order.createdAt, localeName),
amount: item.orderFormattedAmount,
amountFiat: "USD 0.00",
roundedBottom: roundedBottom,
@@ -171,7 +169,7 @@ class HistorySection extends StatelessWidget {
arguments: [item.sessionId, item.transaction],
),
child: PayjoinHistoryTile(
- createdAt: _formatTransactionDate(session.inProgressSince!),
+ createdAt: _formatTransactionDate(session.inProgressSince!, localeName),
amount: dashboardViewModel.appStore.amountParsingProxy
.getDisplayCryptoString(
session.amount.toInt(), CryptoCurrency.btc),
@@ -190,7 +188,7 @@ class HistorySection extends StatelessWidget {
.pushNamed(Routes.anonPayDetailsPage, arguments: transactionInfo),
child: AnonpayHistoryTile(
provider: transactionInfo.provider,
- createdAt: _formatTransactionDate(transactionInfo.createdAt),
+ createdAt: _formatTransactionDate(transactionInfo.createdAt, localeName),
amount: transactionInfo.fiatAmount?.toString() ??
(transactionInfo.amountTo?.toString() ?? ''),
currency: transactionInfo.fiatAmount != null
@@ -220,8 +218,8 @@ class HistorySection extends StatelessWidget {
}
}
- String _formatTransactionDate(DateTime date) {
- final time = DateFormat.Hm();
+ String _formatTransactionDate(DateTime date, String localeName) {
+ final time = DateFormat.Hm(localeName);
final now = DateTime.now();
final today = DateTime(now.year, now.month, now.day);
@@ -239,16 +237,16 @@ class HistorySection extends StatelessWidget {
}
if (daysAgo < 7) {
- final weekday = DateFormat.EEEE().format(date);
+ final weekday = DateFormat.EEEE(localeName).format(date);
return "$weekday, $timeStr";
}
if (date.year == now.year) {
- final dayMonth = DateFormat("d MMMM").format(date);
+ final dayMonth = DateFormat("d MMMM", localeName).format(date);
return "$dayMonth, $timeStr";
}
- final full = DateFormat("d MMM yyyy").format(date);
+ final full = DateFormat("d MMM yyyy", localeName).format(date);
return "$full, $timeStr";
}
}
From 04d22594c8dea3a81f9a4d26bc4210437888e882 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Wed, 1 Jul 2026 17:24:15 +0200
Subject: [PATCH 09/48] add spanish for last 7 days
---
res/values/strings_es.arb | 1 +
1 file changed, 1 insertion(+)
diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb
index 3b5560617..91c41c6f2 100644
--- a/res/values/strings_es.arb
+++ b/res/values/strings_es.arb
@@ -555,6 +555,7 @@
"keys": "Claves",
"label": "Etiqueta",
"label_address": "Etiquetar dirección",
+ "last_7_days": "Últimos 7 días",
"last_30_days": "Últimos 30 días",
"learn_more": "Más información",
"ledger_connection_error": "No se pudo conectar a tu Ledger. Inténtalo de nuevo.",
From ddd66b08eab342c73e8978d8948a1c21b812df38 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Wed, 1 Jul 2026 17:24:38 +0200
Subject: [PATCH 10/48] properly translate month names in history
---
.../widgets/coins_page/assets_history/history_section.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
index 212b7e2cd..2bdd715ac 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
@@ -143,7 +143,7 @@ class HistorySection extends StatelessWidget {
} else if (item is DateSectionItem) {
return Padding(
padding: EdgeInsets.only(left: 8.0, bottom: 8.0, top: topPadding),
- child: Text(DateFormat("MMMM yyyy").format(item.date),
+ child: Text(DateFormat("MMMM yyyy", localeName).format(item.date),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)));
} else if (item is OrderListItem) {
From 63651aa39c82fc6c8f63ef22d89f9096176fcc91 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Wed, 1 Jul 2026 17:24:56 +0200
Subject: [PATCH 11/48] fix line tab switcher updates
---
lib/new-ui/widgets/line_tab_switcher.dart | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/new-ui/widgets/line_tab_switcher.dart b/lib/new-ui/widgets/line_tab_switcher.dart
index b20cd23f7..15927aff6 100644
--- a/lib/new-ui/widgets/line_tab_switcher.dart
+++ b/lib/new-ui/widgets/line_tab_switcher.dart
@@ -1,3 +1,4 @@
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
@@ -29,7 +30,7 @@ class _LineTabSwitcherState extends State {
void didUpdateWidget(covariant LineTabSwitcher oldWidget) {
super.didUpdateWidget(oldWidget);
- if (oldWidget.tabs.length != widget.tabs.length) {
+ if (!listEquals(oldWidget.tabs, widget.tabs)) {
textWidgetKeys = List.generate(widget.tabs.length, (_) => GlobalKey());
textWidgetSizes = [];
totalWidth = 0;
From 46cda778d8a1234eda586f7b3e72a23520e5ef5a Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Wed, 1 Jul 2026 17:25:13 +0200
Subject: [PATCH 12/48] fix date format in tx details
---
lib/view_model/transaction_details_view_model.dart | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart
index 7199ed1a9..18c3c9a2e 100644
--- a/lib/view_model/transaction_details_view_model.dart
+++ b/lib/view_model/transaction_details_view_model.dart
@@ -30,6 +30,7 @@ import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_priority.dart';
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
+import 'package:intl/intl.dart';
import 'package:mobx/mobx.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -77,8 +78,7 @@ class TxDetailRowDefinition {
TxDetailRowDefinition(
keyString: "standard_list_item_transaction_details_date_key",
title: S.current.transaction_details_date,
- valueGetter: (vm) => DateFormatter.withCurrentLocal().format(vm.transactionInfo.date)),
-
+ valueGetter: (vm) => DateFormat("d MMMM yyyy, HH:mm", vm._appStore.settingsStore.languageCode).format(vm.transactionInfo.date)),
TxDetailRowDefinition(
keyString: "standard_list_item_transaction_details_height_key",
title: S.current.transaction_details_height,
From bfeae1eca830cf88a92fef4e0a8195ea39b11505 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Wed, 1 Jul 2026 17:25:22 +0200
Subject: [PATCH 13/48] fix evm decimals in history
---
lib/view_model/dashboard/transaction_list_item.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/view_model/dashboard/transaction_list_item.dart b/lib/view_model/dashboard/transaction_list_item.dart
index 0a38ff2d2..d29fd5296 100644
--- a/lib/view_model/dashboard/transaction_list_item.dart
+++ b/lib/view_model/dashboard/transaction_list_item.dart
@@ -51,7 +51,7 @@ class TransactionListItem extends ActionListItem with Keyable {
.withLocalSeperator(_appStore.settingsStore.languageCode);
}
- return transaction.amount.toStringWithSymbol();
+ return transaction.amount.toStringWithSymbol(fractionalDigits: 8);
}
String get formattedTitle {
From 1af6ab00eb4fd4c375b6888e75b9180ab4038eb2 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 3 Jul 2026 14:46:23 +0200
Subject: [PATCH 14/48] layout fix
---
.../coins_page/assets_history/assets_history_section.dart | 1 +
.../widgets/coins_page/assets_history/history_top_bar.dart | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index 81fad913d..c3f699d52 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -109,6 +109,7 @@ class _AssetsHistorySectionState extends State {
if (tabs.length == 1)
HistoryTopBar(
onTap: () => openHistoryModal(context),
+ roundedBottom: widget.dashboardViewModel.itemsShort.isEmpty,
),
tabs[_selectedTab].content
],
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
index c8749b731..cbb80111b 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
@@ -3,9 +3,10 @@ import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:flutter/material.dart';
class HistoryTopBar extends StatelessWidget {
- const HistoryTopBar({super.key, required this.onTap});
+ const HistoryTopBar({super.key, required this.onTap, required this.roundedBottom});
final VoidCallback onTap;
+ final bool roundedBottom;
@override
Widget build(BuildContext context) {
@@ -19,10 +20,12 @@ class HistoryTopBar extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
+ bottom: roundedBottom ? Radius.zero : Radius.circular(18)
),
color: Theme.of(context).colorScheme.surfaceContainer),
child: Padding(
padding: EdgeInsets.symmetric(
+ vertical: 8,
horizontal: 12,
),
child: Column(
From 7b17459ed00baded5be3c42bcbe58f76c8f4772d Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 3 Jul 2026 14:55:10 +0200
Subject: [PATCH 15/48] layout fix
---
.../widgets/coins_page/assets_history/history_top_bar.dart | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
index cbb80111b..7a3cf0651 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
@@ -20,12 +20,12 @@ class HistoryTopBar extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
- bottom: roundedBottom ? Radius.zero : Radius.circular(18)
+ bottom: roundedBottom ? Radius.circular(18) : Radius.zero
),
color: Theme.of(context).colorScheme.surfaceContainer),
child: Padding(
padding: EdgeInsets.symmetric(
- vertical: 8,
+ vertical: 4,
horizontal: 12,
),
child: Column(
@@ -43,6 +43,7 @@ class HistoryTopBar extends StatelessWidget {
)
],
),
+ if(!roundedBottom)
Container(
height: 1,
width: double.infinity,
From 14dcea5e1a04c643ec7d8fa617e8c95ddbffee03 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 3 Jul 2026 14:55:23 +0200
Subject: [PATCH 16/48] fix silent payments appearing in non-btc wallets
---
.../dashboard/dashboard_view_model.dart | 207 +++++++++---------
1 file changed, 109 insertions(+), 98 deletions(-)
diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart
index bb34a1345..62d916fbc 100644
--- a/lib/view_model/dashboard/dashboard_view_model.dart
+++ b/lib/view_model/dashboard/dashboard_view_model.dart
@@ -96,104 +96,8 @@ abstract class DashboardViewModelBase with Store {
isShowFirstYatIntroduction = false,
isShowSecondYatIntroduction = false,
isShowThirdYatIntroduction = false,
- filterItems = [
- // FilterItem(
- // value: () => transactionFilterStore.displayAll,
- // caption: S.current.all_transactions,
- // onChanged: transactionFilterStore.toggleAll),
- FilterItem(
- value: () => transactionFilterStore.displayOutgoing,
- caption: S.current.send,
- onChanged: transactionFilterStore.toggleOutgoing),
- FilterItem(
- value: () => transactionFilterStore.displayIncoming,
- caption: S.current.receive,
- onChanged: transactionFilterStore.toggleIncoming),
- if (appStore.wallet!.type == WalletType.bitcoin)
- FilterItem(
- value: () => transactionFilterStore.displaySilentPayments,
- caption: S.current.silent_payments,
- onChanged: transactionFilterStore.toggleSilentPayments,
- ),
- SwapFilterItem(
- enabledProviders: () => tradeFilterStore.enabledProviders,
- allEnabled: () => tradeFilterStore.displayAllTrades,
- value: () => tradeFilterStore.enabledProviders>0,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
- FilterItem(
- value: () => orderFilterStore.displayCakePay,
- caption: 'Cake Pay',
- onChanged: () =>
- orderFilterStore.toggleDisplayOrder(OrderProviderDescription.cakePay)),
- ],
- exchangeFilterItems = [
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.changeNow,
- value: () => tradeFilterStore.displayChangeNow,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.sideShift,
- value: () => tradeFilterStore.displaySideShift,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.simpleSwap,
- value: () => tradeFilterStore.displaySimpleSwap,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.trocador,
- value: () => tradeFilterStore.displayTrocador,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.exolix,
- value: () => tradeFilterStore.displayExolix,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.chainflip,
- value: () => tradeFilterStore.displayChainflip,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.chainflip)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.thorChain,
- value: () => tradeFilterStore.displayThorChain,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.thorChain)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.letsExchange,
- value: () => tradeFilterStore.displayLetsExchange,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.stealthEx,
- value: () => tradeFilterStore.displayStealthEx,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.xoSwap,
- value: () => tradeFilterStore.displayXOSwap,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.xoSwap)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.swapTrade,
- value: () => tradeFilterStore.displaySwapTrade,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.swapsXyz,
- value: () => tradeFilterStore.displaySwapXyz,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
- SwapProviderFilterItem(
- providerDescription: ExchangeProviderDescription.nearIntents,
- value: () => tradeFilterStore.displayNearIntents,
- onChanged: () =>
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
- ],
+ filterItems = [],
+ exchangeFilterItems = [],
subname = '',
name = appStore.wallet!.name,
type = appStore.wallet!.type,
@@ -214,6 +118,8 @@ abstract class DashboardViewModelBase with Store {
unawaited(_loadConstraints());
final _wallet = wallet;
+ loadFilterItems();
+
if (_wallet.type == WalletType.monero) {
subname = monero!.getCurrentAccount(_wallet).label;
@@ -346,6 +252,110 @@ abstract class DashboardViewModelBase with Store {
tradeMonitor.monitorActiveTrades(wallet.id);
}
+
+ void loadFilterItems() {
+ filterItems = [
+ // FilterItem(
+ // value: () => transactionFilterStore.displayAll,
+ // caption: S.current.all_transactions,
+ // onChanged: transactionFilterStore.toggleAll),
+ FilterItem(
+ value: () => transactionFilterStore.displayOutgoing,
+ caption: S.current.send,
+ onChanged: transactionFilterStore.toggleOutgoing),
+ FilterItem(
+ value: () => transactionFilterStore.displayIncoming,
+ caption: S.current.receive,
+ onChanged: transactionFilterStore.toggleIncoming),
+ if (appStore.wallet!.type == WalletType.bitcoin)
+ FilterItem(
+ value: () => transactionFilterStore.displaySilentPayments,
+ caption: S.current.silent_payments,
+ onChanged: transactionFilterStore.toggleSilentPayments,
+ ),
+ SwapFilterItem(
+ enabledProviders: () => tradeFilterStore.enabledProviders,
+ allEnabled: () => tradeFilterStore.displayAllTrades,
+ value: () => tradeFilterStore.enabledProviders>0,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
+ FilterItem(
+ value: () => orderFilterStore.displayCakePay,
+ caption: 'Cake Pay',
+ onChanged: () =>
+ orderFilterStore.toggleDisplayOrder(OrderProviderDescription.cakePay)),
+ ];
+ exchangeFilterItems = [
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.changeNow,
+ value: () => tradeFilterStore.displayChangeNow,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.sideShift,
+ value: () => tradeFilterStore.displaySideShift,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.simpleSwap,
+ value: () => tradeFilterStore.displaySimpleSwap,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.trocador,
+ value: () => tradeFilterStore.displayTrocador,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.exolix,
+ value: () => tradeFilterStore.displayExolix,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.chainflip,
+ value: () => tradeFilterStore.displayChainflip,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.chainflip)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.thorChain,
+ value: () => tradeFilterStore.displayThorChain,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.thorChain)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.letsExchange,
+ value: () => tradeFilterStore.displayLetsExchange,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.stealthEx,
+ value: () => tradeFilterStore.displayStealthEx,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.xoSwap,
+ value: () => tradeFilterStore.displayXOSwap,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.xoSwap)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.swapTrade,
+ value: () => tradeFilterStore.displaySwapTrade,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.swapsXyz,
+ value: () => tradeFilterStore.displaySwapXyz,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
+ SwapProviderFilterItem(
+ providerDescription: ExchangeProviderDescription.nearIntents,
+ value: () => tradeFilterStore.displayNearIntents,
+ onChanged: () =>
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
+ ];
+ }
+
+
+
bool _isTransactionDisposerCallbackRunning = false;
@action
@@ -1254,6 +1264,7 @@ abstract class DashboardViewModelBase with Store {
this.wallet = wallet;
type = wallet.type;
name = wallet.name;
+ loadFilterItems();
if (wallet.type == WalletType.monero) {
subname = monero!.getCurrentAccount(wallet).label;
From 764f3d9ea568ab83fe73d20e4c39c3e148cd873f Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 3 Jul 2026 15:44:25 +0200
Subject: [PATCH 17/48] fix history buton padding w no txs
---
.../widgets/coins_page/assets_history/history_top_bar.dart | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
index 7a3cf0651..a46bb1ced 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_top_bar.dart
@@ -49,6 +49,7 @@ class HistoryTopBar extends StatelessWidget {
width: double.infinity,
color: Theme.of(context).colorScheme.outlineVariant.withAlpha(175),
)
+ else Container(height: 2)
],
),
),
From 474312464b469fbee279ad4aae196dca030c3f52 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 3 Jul 2026 16:28:12 +0200
Subject: [PATCH 18/48] wrap HistoryTopBar in Observer
---
.../assets_history/assets_history_section.dart | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index c3f699d52..8d5dfce09 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -9,6 +9,7 @@ import 'package:cake_wallet/src/screens/dashboard/pages/nft_listing_page.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'assets_section.dart';
@@ -107,9 +108,11 @@ class _AssetsHistorySectionState extends State {
selectedTab: _selectedTab,
),
if (tabs.length == 1)
- HistoryTopBar(
- onTap: () => openHistoryModal(context),
- roundedBottom: widget.dashboardViewModel.itemsShort.isEmpty,
+ Observer(
+ builder:(_)=> HistoryTopBar(
+ onTap: () => openHistoryModal(context),
+ roundedBottom: widget.dashboardViewModel.itemsShort.isEmpty,
+ ),
),
tabs[_selectedTab].content
],
From 92f1314d940feb0afc5cbe7e681ac2599cd238e3 Mon Sep 17 00:00:00 2001
From: Robert Malikowski
Date: Fri, 3 Jul 2026 17:55:06 +0200
Subject: [PATCH 19/48] reset filters after closing history modal
---
.../coins_page/assets_history/assets_history_section.dart | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index 8d5dfce09..79eb395f5 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -119,8 +119,8 @@ class _AssetsHistorySectionState extends State {
);
}
- void openHistoryModal(BuildContext context) {
- CupertinoScaffold.showCupertinoModalBottomSheet(
+ Future openHistoryModal(BuildContext context) async {
+ await CupertinoScaffold.showCupertinoModalBottomSheet(
context: context,
builder: (context) => ModalNavigator(
rootPage: Material(
@@ -128,5 +128,6 @@ class _AssetsHistorySectionState extends State {
child: HistoryModal(dashboardViewModel: widget.dashboardViewModel)),
parentContext: context,
));
+ widget.dashboardViewModel.changeAllFilterItems(true);
}
}
From 00b7d7ce0d59e43d6f887cbb5e11217a23e130e8 Mon Sep 17 00:00:00 2001
From: Omar
Date: Sun, 5 Jul 2026 02:34:13 +0300
Subject: [PATCH 20/48] minor fixes
---
cw_bitcoin/lib/lightning/lightning_wallet.dart | 4 +++-
cw_core/lib/parse_fixed.dart | 7 +++++++
res/values/strings_it.arb | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/cw_bitcoin/lib/lightning/lightning_wallet.dart b/cw_bitcoin/lib/lightning/lightning_wallet.dart
index d78c88d13..d93a84b58 100644
--- a/cw_bitcoin/lib/lightning/lightning_wallet.dart
+++ b/cw_bitcoin/lib/lightning/lightning_wallet.dart
@@ -123,7 +123,9 @@ class LightningWallet {
Future close() async {
_eventSubscription?.cancel();
- await _sdk?.disconnect();
+ try {
+ await _sdk?.disconnect();
+ } catch (_) {}
_logSubscription?.cancel();
}
diff --git a/cw_core/lib/parse_fixed.dart b/cw_core/lib/parse_fixed.dart
index fede4df09..51a6a7a58 100644
--- a/cw_core/lib/parse_fixed.dart
+++ b/cw_core/lib/parse_fixed.dart
@@ -29,6 +29,13 @@ BigInt? tryParseFixed(String value, int decimals) {
BigInt parseFixed(String value, int decimals) {
final multiplier = getMultiplier(decimals);
+ /// handle weird cases where users enter spaces and currency after the amount
+ /// This should be handled from UI field to prevent non numerical values
+ /// but will be in the refactoring
+ if (value.contains(" ")) {
+ value = value.split(" ").first;
+ }
+
final negative = value.startsWith("-");
if (negative) value = value.substring(1);
diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb
index 03da71fc5..2bd228544 100644
--- a/res/values/strings_it.arb
+++ b/res/values/strings_it.arb
@@ -166,7 +166,7 @@
"centralized": "Centralizzato",
"chain_id": "ID catena",
"chains": "Chain",
- "change": "Resto",
+ "change": "Cambia",
"change_backup_password_alert": "I tuoi file di backup precedenti non potranno essere importati con la nuova password di backup. La nuova password di backup verrà usata solo per i nuovi file di backup. Sei sicuro di voler cambiare la password di backup?",
"change_currency": "Cambia valuta",
"change_current_node": "Sei sicuro di voler cambiare il nodo corrente in ${node}?",
From 839530063172bede108c61bbaaccd3539febc2ae Mon Sep 17 00:00:00 2001
From: Omar Hatem
Date: Sun, 5 Jul 2026 17:10:26 +0300
Subject: [PATCH 21/48] remove old providers [skip ci]
---
lib/store/dashboard/trade_filter_store.dart | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart
index abc4c337a..2fee9cc70 100644
--- a/lib/store/dashboard/trade_filter_store.dart
+++ b/lib/store/dashboard/trade_filter_store.dart
@@ -71,10 +71,8 @@ abstract class TradeFilterStoreBase with Store {
@computed
int get enabledProviders => [
- displayXMRTO,
displayChangeNow,
displaySideShift,
- displayMorphToken,
displaySimpleSwap,
displayTrocador,
displayExolix,
From 6cb31493223039a79be9e723b70518c0fe4405a1 Mon Sep 17 00:00:00 2001
From: Konstantin Ullrich
Date: Mon, 6 Jul 2026 14:42:03 +0200
Subject: [PATCH 22/48] feat: add lightning preimage to transaction details
---
.../lib/lightning/lightning_wallet.dart | 10 ++++++++-
.../transaction_details_view_model.dart | 21 +++++++++++--------
res/values/strings_en.arb | 3 ++-
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/cw_bitcoin/lib/lightning/lightning_wallet.dart b/cw_bitcoin/lib/lightning/lightning_wallet.dart
index d93a84b58..42dda7cb2 100644
--- a/cw_bitcoin/lib/lightning/lightning_wallet.dart
+++ b/cw_bitcoin/lib/lightning/lightning_wallet.dart
@@ -441,6 +441,11 @@ class LightningWallet {
direction = TransactionDirection.incoming;
}
+ String? preimage;
+ if (payment.details != null && payment.details is PaymentDetails_Lightning) {
+ preimage = (payment.details as PaymentDetails_Lightning).htlcDetails.preimage;
+ }
+
return ElectrumTransactionInfo(
WalletType.bitcoin,
id: payment.id,
@@ -450,7 +455,10 @@ class LightningWallet {
fee: Money(payment.fees, currency),
date: DateTime.fromMillisecondsSinceEpoch(payment.timestamp.toInt() * 1000),
confirmations: payment.status == PaymentStatus.pending ? 0 : 10,
- additionalInfo: {"isLightning": true},
+ additionalInfo: {
+ "isLightning": true,
+ if (preimage != null) "preimage": preimage,
+ },
);
}
diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart
index 7199ed1a9..0cc1bdb82 100644
--- a/lib/view_model/transaction_details_view_model.dart
+++ b/lib/view_model/transaction_details_view_model.dart
@@ -9,7 +9,6 @@ import 'package:cake_wallet/zano/zano.dart';
import 'package:cw_core/crypto_amount_format.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/currency_for_wallet_type.dart';
-import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/wallet_type.dart';
@@ -50,10 +49,9 @@ String _moneroRecipientAddressForDisplay(String raw, WalletType walletType) {
return match?.group(0) ?? raw.trim();
}
-bool isLightning(TransactionInfo tx) {
- printV(tx.additionalInfo);
- return (tx.additionalInfo["isLightning"] as bool?) ?? false;
-}
+bool isLightning(TransactionInfo tx) => (tx.additionalInfo["isLightning"] as bool?) ?? false;
+
+bool hasLightningPreimage(TransactionInfo tx) => (tx.additionalInfo["preimage"] as String?) != null;
class TxDetailRowDefinition {
final String keyString;
@@ -188,6 +186,13 @@ class TxDetailRowDefinition {
},
applicable: (vm) => vm.wallet.type == WalletType.monero),
+ TxDetailRowDefinition(
+ keyString: "standard_list_item_lightning_preimage",
+ title: S.current.transaction_preimage,
+ valueGetter: (vm) => vm.transactionInfo.additionalInfo['preimage'] as String? ?? "",
+ applicable: (vm) =>
+ hasLightningPreimage(vm.transactionInfo) && isLightning(vm.transactionInfo),
+ ),
TxDetailRowDefinition(
keyString: "standard_list_item_transaction_confirmed_key",
@@ -316,10 +321,9 @@ abstract class TransactionDetailsViewModelBase with Store {
TransactionPriority? transactionPriority;
CryptoCurrency get transactionAsset {
+ if (isEVMCompatibleChain(wallet.type)) return evm!.assetOfTransaction(wallet, transactionInfo);
- if (isEVMCompatibleChain(wallet.type)) {
- return evm!.assetOfTransaction(wallet, transactionInfo);
- }
+ if (isLightning(transactionInfo)) return CryptoCurrency.btcln;
return switch (wallet.type) {
WalletType.solana => solana!.assetOfTransaction(wallet, transactionInfo),
@@ -329,7 +333,6 @@ abstract class TransactionDetailsViewModelBase with Store {
};
}
-
// TODO integrate these getters with the TransactionInfo object
String get formattedPendingStatus {
switch (wallet.type) {
diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb
index 1debd0a8f..1523c53e2 100644
--- a/res/values/strings_en.arb
+++ b/res/values/strings_en.arb
@@ -1253,6 +1253,7 @@
"transaction_error": "Transaction Error",
"transaction_key": "Transaction Key",
"transaction_memo_optional": "Transaction Memo (optional)",
+ "transaction_preimage": "Preimage",
"transaction_priority_fast": "Fast",
"transaction_priority_fastest": "Fastest",
"transaction_priority_medium": "Medium",
@@ -1452,4 +1453,4 @@
"zcash_card_missing_funds": "Missing funds?",
"zcash_card_scan": "Scan",
"zcash_card_warning": "Do not close the app until the procedure completes, if you do so this process will need to restart from scratch."
-}
\ No newline at end of file
+}
From 7928c912e81d88df803e7ec5c3c1065b252ec9f6 Mon Sep 17 00:00:00 2001
From: Serhii <17529954+serhii-bor@users.noreply.github.com>
Date: Mon, 6 Jul 2026 16:48:30 +0300
Subject: [PATCH 23/48] Address resolver refactoring (#3291)
* restructure address resolver sources
* refactor address resolver into lookup service
* refactor address resolver to provider pattern
* use addressSource to drive providers & settings
* error handling
* add address source icons
* Update lib/core/address_validator.dart [skip ci]
Co-authored-by: Omar Hatem
* review fixes
* add validations to extractParsedAddress
* skip address resolver for valid addresses
* minor fix [skip ci]
* fix formattedName x[skip ci]
Co-authored-by: malik1004x
* fix formatted name zano [skip ci]
Co-authored-by: malik1004x
* address PR review comments
* add icons for new address source resolvers
* confirm parsed addresses in contacts
* minor fixes
* LNUrl for BTCLN only and contact name handling
---------
Co-authored-by: Omar Hatem
Co-authored-by: malik1004x
---
.../src/cards/cake_pay_buy_card_page.dart | 16 +-
.../address_lookup_provider.dart | 22 +
.../address_resolver_service.dart | 143 +++++
.../address_resolver_utils.dart | 104 ++++
.../address_resolver/address_sources.dart | 87 +++
.../bip_353/bip_353_address_provider.dart | 68 +++
.../bip_353}/bip_353_record.dart | 71 +--
.../ens/ens_address_provider.dart | 49 ++
lib/core/address_resolver/ens/ens_record.dart | 55 ++
.../fio/fio_address_provider.dart | 125 ++++
.../lnurl_pay/lnurl_pay_address_provider.dart | 66 +++
.../lnurl_pay}/lnurlpay_record.dart | 0
.../mastodon/mastodon_address_provider.dart | 93 +++
.../mastodon/mastodon_api.dart | 2 +-
.../mastodon/mastodon_user.dart | 0
.../nostr/nostr_address_provider.dart | 66 +++
.../address_resolver/nostr/nostr_api.dart | 127 ++++
.../address_resolver}/nostr/nostr_user.dart | 0
.../openalias/openalias_address_provider.dart | 64 ++
.../openalias/openalias_record.dart | 69 +++
lib/core/address_resolver/parsed_address.dart | 22 +
.../thorchain/thorchain_address_provider.dart | 65 +++
.../twitter/twitter_address_provider.dart | 97 ++++
.../twitter/twitter_api.dart | 2 +-
.../twitter/twitter_user.dart | 0
.../unstoppable_address_provider.dart | 235 ++++++++
.../wellknown/wellknown_address_provider.dart | 49 ++
.../wellknown/wellknown_record.dart | 78 +++
.../yat/yat_address_provider.dart | 59 ++
lib/core/address_resolver/yat/yat_record.dart | 19 +
.../address_resolver/yat/yat_service.dart | 67 +++
.../address_resolver}/yat/yat_store.dart | 0
.../zano/zano_alias_address_provider.dart | 75 +++
.../zcash/zcash_address_provider.dart | 49 ++
.../zcash/zcash_me_address_provider.dart | 74 +++
.../zcash}/zcash_names_record.dart | 0
lib/core/address_validator.dart | 87 ++-
lib/core/yat_service.dart | 55 --
lib/di.dart | 27 +-
lib/entities/ens_record.dart | 54 --
lib/entities/fio_address_provider.dart | 65 ---
lib/entities/openalias_record.dart | 89 ---
lib/entities/parse_address_from_domain.dart | 549 ------------------
lib/entities/parsed_address.dart | 212 -------
lib/entities/preferences_key.dart | 6 +
lib/entities/unstoppable_domain_address.dart | 30 -
lib/entities/wellknown_record.dart | 93 ---
lib/entities/yat_record.dart | 13 -
lib/entities/zano_alias.dart | 29 -
lib/new-ui/pages/send_page.dart | 59 +-
lib/new-ui/pages/swap_page.dart | 13 +-
.../lightning_username_bloc.dart | 2 +-
.../widgets/send_page/send_confirm_sheet.dart | 15 +-
lib/nostr/nostr_api.dart | 150 -----
lib/src/screens/buy/buy_sell_page.dart | 42 +-
.../screens/contact/contact_list_page.dart | 1 +
lib/src/screens/contact/contact_page.dart | 52 +-
lib/src/screens/exchange/exchange_page.dart | 10 +-
lib/src/screens/send/send_page.dart | 1 -
.../widgets/extract_address_from_parsed.dart | 150 -----
lib/src/screens/send/widgets/send_card.dart | 5 -
.../send/widgets/send_template_card.dart | 2 -
.../screens/settings/domain_lookups_page.dart | 57 +-
.../screens/wallet_list/filtered_list.dart | 3 +
lib/src/screens/yat/yat_popup.dart | 2 +-
lib/src/widgets/base_alert_dialog.dart | 6 +-
.../confirm_sending_bottom_sheet_widget.dart | 2 +-
lib/store/settings_store.dart | 69 ++-
lib/store/yat/yat_exception.dart | 10 -
.../contact_list/contact_view_model.dart | 61 +-
.../dashboard/dashboard_view_model.dart | 2 +-
.../restore/wallet_restore_from_qr_code.dart | 4 +-
lib/view_model/send/output.dart | 65 ++-
lib/view_model/send/send_view_model.dart | 50 +-
.../settings/connection_sync_view_model.dart | 139 ++++-
.../wallet_address_list_view_model.dart | 2 +-
pubspec_base.yaml | 1 +
res/pictures/address_sources/bip353.svg | 4 +
res/pictures/address_sources/ens.svg | 14 +
res/pictures/address_sources/fio.svg | 20 +
.../address_sources/icon-lnurl-pay.svg | 4 +
.../address_sources/icon-thorchain.svg | 16 +
.../address_sources/icon-zcash-me.svg | 230 ++++++++
.../address_sources/icon-zcashnames.svg | 52 ++
res/pictures/address_sources/mastodon.svg | 11 +
res/pictures/address_sources/nostr.svg | 4 +
res/pictures/address_sources/openalias.svg | 13 +
res/pictures/address_sources/unstoppable.svg | 5 +
res/pictures/address_sources/wellknown.svg | 4 +
res/pictures/address_sources/x.svg | 11 +
res/pictures/address_sources/yat.svg | 11 +
res/pictures/address_sources/zano.svg | 37 ++
.../parse_address_from_domain_test.dart | 2 +-
93 files changed, 3044 insertions(+), 1796 deletions(-)
create mode 100644 lib/core/address_resolver/address_lookup_provider.dart
create mode 100644 lib/core/address_resolver/address_resolver_service.dart
create mode 100644 lib/core/address_resolver/address_resolver_utils.dart
create mode 100644 lib/core/address_resolver/address_sources.dart
create mode 100644 lib/core/address_resolver/bip_353/bip_353_address_provider.dart
rename lib/{entities => core/address_resolver/bip_353}/bip_353_record.dart (59%)
create mode 100644 lib/core/address_resolver/ens/ens_address_provider.dart
create mode 100644 lib/core/address_resolver/ens/ens_record.dart
create mode 100644 lib/core/address_resolver/fio/fio_address_provider.dart
create mode 100644 lib/core/address_resolver/lnurl_pay/lnurl_pay_address_provider.dart
rename lib/{entities => core/address_resolver/lnurl_pay}/lnurlpay_record.dart (100%)
create mode 100644 lib/core/address_resolver/mastodon/mastodon_address_provider.dart
rename lib/{ => core/address_resolver}/mastodon/mastodon_api.dart (95%)
rename lib/{ => core/address_resolver}/mastodon/mastodon_user.dart (100%)
create mode 100644 lib/core/address_resolver/nostr/nostr_address_provider.dart
create mode 100644 lib/core/address_resolver/nostr/nostr_api.dart
rename lib/{ => core/address_resolver}/nostr/nostr_user.dart (100%)
create mode 100644 lib/core/address_resolver/openalias/openalias_address_provider.dart
create mode 100644 lib/core/address_resolver/openalias/openalias_record.dart
create mode 100644 lib/core/address_resolver/parsed_address.dart
create mode 100644 lib/core/address_resolver/thorchain/thorchain_address_provider.dart
create mode 100644 lib/core/address_resolver/twitter/twitter_address_provider.dart
rename lib/{ => core/address_resolver}/twitter/twitter_api.dart (96%)
rename lib/{ => core/address_resolver}/twitter/twitter_user.dart (100%)
create mode 100644 lib/core/address_resolver/unstoppable/unstoppable_address_provider.dart
create mode 100644 lib/core/address_resolver/wellknown/wellknown_address_provider.dart
create mode 100644 lib/core/address_resolver/wellknown/wellknown_record.dart
create mode 100644 lib/core/address_resolver/yat/yat_address_provider.dart
create mode 100644 lib/core/address_resolver/yat/yat_record.dart
create mode 100644 lib/core/address_resolver/yat/yat_service.dart
rename lib/{store => core/address_resolver}/yat/yat_store.dart (100%)
create mode 100644 lib/core/address_resolver/zano/zano_alias_address_provider.dart
create mode 100644 lib/core/address_resolver/zcash/zcash_address_provider.dart
create mode 100644 lib/core/address_resolver/zcash/zcash_me_address_provider.dart
rename lib/{entities => core/address_resolver/zcash}/zcash_names_record.dart (100%)
delete mode 100644 lib/core/yat_service.dart
delete mode 100644 lib/entities/ens_record.dart
delete mode 100644 lib/entities/fio_address_provider.dart
delete mode 100644 lib/entities/openalias_record.dart
delete mode 100644 lib/entities/parse_address_from_domain.dart
delete mode 100644 lib/entities/parsed_address.dart
delete mode 100644 lib/entities/unstoppable_domain_address.dart
delete mode 100644 lib/entities/wellknown_record.dart
delete mode 100644 lib/entities/yat_record.dart
delete mode 100644 lib/entities/zano_alias.dart
delete mode 100644 lib/nostr/nostr_api.dart
delete mode 100644 lib/src/screens/send/widgets/extract_address_from_parsed.dart
delete mode 100644 lib/store/yat/yat_exception.dart
create mode 100644 res/pictures/address_sources/bip353.svg
create mode 100644 res/pictures/address_sources/ens.svg
create mode 100644 res/pictures/address_sources/fio.svg
create mode 100644 res/pictures/address_sources/icon-lnurl-pay.svg
create mode 100644 res/pictures/address_sources/icon-thorchain.svg
create mode 100644 res/pictures/address_sources/icon-zcash-me.svg
create mode 100644 res/pictures/address_sources/icon-zcashnames.svg
create mode 100644 res/pictures/address_sources/mastodon.svg
create mode 100644 res/pictures/address_sources/nostr.svg
create mode 100644 res/pictures/address_sources/openalias.svg
create mode 100644 res/pictures/address_sources/unstoppable.svg
create mode 100644 res/pictures/address_sources/wellknown.svg
create mode 100644 res/pictures/address_sources/x.svg
create mode 100644 res/pictures/address_sources/yat.svg
create mode 100644 res/pictures/address_sources/zano.svg
diff --git a/lib/cake_pay/src/cards/cake_pay_buy_card_page.dart b/lib/cake_pay/src/cards/cake_pay_buy_card_page.dart
index 5442dcff1..8380897b9 100644
--- a/lib/cake_pay/src/cards/cake_pay_buy_card_page.dart
+++ b/lib/cake_pay/src/cards/cake_pay_buy_card_page.dart
@@ -11,8 +11,8 @@ import 'package:cake_wallet/cake_pay/src/widgets/link_extractor.dart';
import 'package:cake_wallet/cake_pay/src/widgets/rounded_overlay_cards_widget.dart';
import 'package:cake_wallet/cake_pay/src/widgets/text_icon_button.dart';
import 'package:cake_wallet/cake_pay/src/widgets/three_checkbox_alert_content_widget.dart';
+import 'package:cake_wallet/core/address_resolver/parsed_address.dart';
import 'package:cake_wallet/core/execution_state.dart';
-import 'package:cake_wallet/entities/parsed_address.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/keyboard_hide_overlay.dart';
import 'package:cake_wallet/routes.dart';
@@ -584,8 +584,11 @@ class CakePayBuyCardPage extends BasePage {
final displayingOutputs = _sendViewModel.outputs
.map((o) => o.OutputCopyWithParsedAddress(
parsedAddress: ParsedAddress(
- addresses: [o.address],
- name: 'Cake Pay',
+ parsedAddressByCurrencyMap: {
+ cakePayBuyCardViewModel.sendViewModel.selectedCryptoCurrency:
+ o.address,
+ },
+ handle: 'Cake Pay',
profileName: order?.cards.first.cardName ?? 'Cake Pay',
profileImageUrl: order?.cards.first.cardImagePath ?? '',
),
@@ -653,8 +656,11 @@ class CakePayBuyCardPage extends BasePage {
final displayingOutputs = outputsCopy
.map((o) => o.OutputCopyWithParsedAddress(
parsedAddress: ParsedAddress(
- addresses: [o.address],
- name: 'Cake Pay',
+ parsedAddressByCurrencyMap: {
+ cakePayBuyCardViewModel.sendViewModel.selectedCryptoCurrency:
+ o.address,
+ },
+ handle: 'Cake Pay',
profileName: order?.cards.first.cardName ?? 'Cake Pay',
profileImageUrl: order?.cards.first.cardImagePath ?? '',
),
diff --git a/lib/core/address_resolver/address_lookup_provider.dart b/lib/core/address_resolver/address_lookup_provider.dart
new file mode 100644
index 000000000..9feff5610
--- /dev/null
+++ b/lib/core/address_resolver/address_lookup_provider.dart
@@ -0,0 +1,22 @@
+import 'package:cake_wallet/core/address_resolver/address_sources.dart';
+import 'package:cake_wallet/core/address_resolver/parsed_address.dart';
+import 'package:cake_wallet/store/settings_store.dart';
+import 'package:cw_core/crypto_currency.dart';
+import 'package:cw_core/wallet_base.dart';
+
+abstract class AddressLookupProvider {
+
+ AddressSource get source;
+
+ List get supportedCurrencies;
+
+ bool isEnabled(SettingsStore settingsStore);
+
+ bool canHandle(String query);
+
+ Future> resolve({
+ required String query,
+ required List currencies,
+ required WalletBase wallet,
+ });
+}
diff --git a/lib/core/address_resolver/address_resolver_service.dart b/lib/core/address_resolver/address_resolver_service.dart
new file mode 100644
index 000000000..8592c53c6
--- /dev/null
+++ b/lib/core/address_resolver/address_resolver_service.dart
@@ -0,0 +1,143 @@
+import 'package:cake_wallet/core/address_resolver/address_lookup_provider.dart';
+import 'package:cake_wallet/core/address_resolver/address_sources.dart';
+import 'package:cake_wallet/core/address_resolver/bip_353/bip_353_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/ens/ens_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/fio/fio_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/lnurl_pay/lnurl_pay_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/mastodon/mastodon_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/nostr/nostr_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/openalias/openalias_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/parsed_address.dart';
+import 'package:cake_wallet/core/address_resolver/thorchain/thorchain_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/twitter/twitter_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/unstoppable/unstoppable_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/wellknown/wellknown_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/yat/yat_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/zano/zano_alias_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/zcash/zcash_address_provider.dart';
+import 'package:cake_wallet/core/address_resolver/zcash/zcash_me_address_provider.dart';
+import 'package:cake_wallet/store/settings_store.dart';
+import 'package:cw_core/crypto_currency.dart';
+import 'package:cw_core/utils/print_verbose.dart';
+import 'package:cw_core/wallet_base.dart';
+
+class AddressResolverService {
+ AddressResolverService({required this.settingsStore});
+
+ final SettingsStore settingsStore;
+
+// Sources available for address resolution and lookup settings.
+ static const supportedSources = [
+ AddressSource.lnurlPay,
+ AddressSource.twitter,
+ AddressSource.mastodon,
+ AddressSource.yatRecord,
+ AddressSource.unstoppableDomains,
+ AddressSource.openAlias,
+ AddressSource.ens,
+ AddressSource.zcashName,
+ AddressSource.zcashAddress,
+ AddressSource.wellKnown,
+ AddressSource.zanoAlias,
+ AddressSource.bip353,
+ AddressSource.fio,
+ AddressSource.thorChain,
+ AddressSource.nostr,
+ ];
+
+ List _buildProviders() {
+ final allProviders = [
+ LNUrlPayAddressProvider(),
+ TwitterAddressProvider(),
+ MastodonAddressProvider(),
+ YatAddressProvider(),
+ UnstoppableAddressProvider(),
+ OpenaliasAddressProvider(),
+ EnsAddressProvider(),
+ ZcashNameAddressProvider(),
+ ZcashMeAddressProvider(),
+ WellKnownAddressProvider(),
+ ZanoAliasAddressProvider(),
+ Bip353AddressProvider(),
+ FioAddressProvider(),
+ ThorchainAddressProvider(),
+ NostrAddressProvider(),
+ ];
+
+ return allProviders.where((provider) => supportedSources.contains(provider.source)).toList();
+ }
+
+ Future> resolve({
+ required String query,
+ required WalletBase wallet,
+ required CryptoCurrency currency,
+ }) async {
+ try {
+ final providers = _buildProviders();
+ // return first entry if currency is specified and provider supports it
+ if (currency != null) {
+ for (final provider in providers) {
+ final cur = currency.title;
+ final src = provider.source.label;
+
+ printV('[address resolver service] checking $src - $cur - $query');
+ if (!provider.isEnabled(settingsStore)) {
+ printV('[address resolver service] ...skipping $src (disabled)');
+ continue;
+ }
+ if (!provider.canHandle(query)) {
+ printV('[address resolver service] ...skipping $src (cannot handle)');
+ continue;
+ }
+ if (!provider.supportedCurrencies.contains(currency)) {
+ printV('[address resolver service] ...skipping $src (unsupported currency)');
+ continue;
+ }
+
+ try {
+ printV('[address resolver service] ...resolving $src - $cur - $query');
+ final results = await provider.resolve(
+ query: query,
+ currencies: [currency],
+ wallet: wallet,
+ );
+
+ if (results.isNotEmpty) {
+ final parsedAddress = results.first.parsedAddressByCurrencyMap[currency];
+ final parsedAddressStr = parsedAddress == null || parsedAddress.isEmpty ? 'N/A' : parsedAddress;
+ printV('[address resolver service] resolved $src - $cur - $parsedAddressStr');
+ return [results.first];
+ }
+ } catch (e) {
+ printV('[address resolver service] Error resolving $src: $e');
+ }
+ }
+
+ return [];
+ }
+
+ return []; // TODO: Implement multi-currency resolution if no specific currency is provided.
+
+ final tasks = >>[];
+
+ for (final provider in providers) {
+ if (!provider.isEnabled(settingsStore)) continue;
+ if (!provider.canHandle(query)) continue;
+
+ tasks.add(
+ provider.resolve(
+ query: query,
+ currencies: provider.supportedCurrencies,
+ wallet: wallet,
+ ),
+ );
+ }
+
+ final results = await Future.wait(tasks);
+ return results.expand((items) => items).toList();
+ } catch (e) {
+ printV('Error resolving address: $e');
+ return [];
+ }
+ }
+}
diff --git a/lib/core/address_resolver/address_resolver_utils.dart b/lib/core/address_resolver/address_resolver_utils.dart
new file mode 100644
index 000000000..f9f59240c
--- /dev/null
+++ b/lib/core/address_resolver/address_resolver_utils.dart
@@ -0,0 +1,104 @@
+import 'package:cake_wallet/core/address_resolver/unstoppable/unstoppable_address_provider.dart';
+import 'package:cake_wallet/core/address_validator.dart';
+import 'package:cw_core/crypto_currency.dart';
+import 'package:cw_core/utils/print_verbose.dart';
+
+class AddressResolverUtils {
+ static Future
', caseSensitive: false), '\n')
+ .replaceAll(RegExp(r'<[^>]*>'), ' ')
+ .trim();
+ }
+}
diff --git a/lib/core/address_resolver/address_sources.dart b/lib/core/address_resolver/address_sources.dart
new file mode 100644
index 000000000..729ef478a
--- /dev/null
+++ b/lib/core/address_resolver/address_sources.dart
@@ -0,0 +1,87 @@
+import 'package:cake_wallet/core/address_validator.dart';
+import 'package:cw_core/crypto_currency.dart';
+
+enum AddressSource {
+ twitter(label: 'X', iconPath: 'assets/new-ui/address_sources/x.svg', alias: '@username'),
+ unstoppableDomains(
+ label: 'Unstoppable Domains',
+ iconPath: 'assets/new-ui/address_sources/unstoppable.svg',
+ alias: 'domain.tld'),
+ openAlias(
+ label: 'OpenAlias',
+ iconPath: 'assets/new-ui/address_sources/openalias.svg',
+ alias: 'name.domain.tld'),
+ yatRecord(label: 'Yat', iconPath: 'assets/new-ui/address_sources/yat.svg', alias: '🎂🎂🎂'),
+ fio(label: 'FIO', iconPath: 'assets/new-ui/address_sources/fio.svg', alias: 'user@domain'),
+ ens(
+ label: 'Ethereum Name Service',
+ iconPath: 'assets/new-ui/address_sources/ens.svg',
+ alias: 'domain.eth'),
+ mastodon(
+ label: 'Mastodon',
+ iconPath: 'assets/new-ui/address_sources/mastodon.svg',
+ alias: '@username@domain.tld'),
+ nostr(
+ label: 'Nostr',
+ iconPath: 'assets/new-ui/address_sources/nostr.svg',
+ alias: 'user@domain.tld'),
+ thorChain(
+ label: 'ThorChain',
+ iconPath: 'assets/new-ui/address_sources/icon-thorchain.svg',
+ alias: 'name'),
+ wellKnown(
+ label: '.wellknown',
+ iconPath: 'assets/new-ui/address_sources/wellknown.svg',
+ alias: 'domain.tld'),
+ zanoAlias(
+ label: 'Zano Alias', iconPath: 'assets/new-ui/address_sources/zano.svg', alias: '@alias'),
+ bip353(
+ label: 'BIP353',
+ iconPath: 'assets/new-ui/address_sources/bip353.svg',
+ alias: 'user@domain.com'),
+ zcashAddress(
+ label: 'Zcash.me',
+ iconPath: 'assets/new-ui/address_sources/icon-zcash-me.svg',
+ alias: 'zcash.me/username'),
+ zcashName(
+ label: 'Zcash Names',
+ iconPath: 'assets/new-ui/address_sources/icon-zcashnames.svg',
+ alias: 'name.zec'),
+ lnurlPay(
+ label: 'LNURL Pay',
+ iconPath: 'assets/new-ui/address_sources/icon-lnurl-pay.svg',
+ alias: 'user@domain.com'),
+ contact(label: 'Contact', iconPath: ''),
+ notParsed(label: 'Unknown', iconPath: ''),
+ ;
+
+ const AddressSource({
+ required this.label,
+ required this.iconPath,
+ this.alias = '',
+ });
+
+ final String label;
+ final String iconPath;
+ final String alias;
+}
+
+extension AddressSourceIndex on AddressSource {
+ int get raw => index;
+
+ static AddressSource fromRaw(int raw) =>
+ AddressSource.values[raw.clamp(0, AddressSource.values.length - 1)];
+}
+
+extension AddressSourceNameParser on AddressSource {
+ static AddressSource fromLabel(String? text) {
+ if (text == null || text.trim().isEmpty) {
+ return AddressSource.notParsed;
+ }
+ final needle = text.trim().toLowerCase();
+ return AddressSource.values.firstWhere(
+ (src) => src.label.toLowerCase() == needle,
+ orElse: () => AddressSource.notParsed,
+ );
+ }
+}
diff --git a/lib/core/address_resolver/bip_353/bip_353_address_provider.dart b/lib/core/address_resolver/bip_353/bip_353_address_provider.dart
new file mode 100644
index 000000000..3a46f87a4
--- /dev/null
+++ b/lib/core/address_resolver/bip_353/bip_353_address_provider.dart
@@ -0,0 +1,68 @@
+import 'package:cake_wallet/core/address_resolver/address_lookup_provider.dart';
+import 'package:cake_wallet/core/address_resolver/address_sources.dart';
+import 'package:cake_wallet/core/address_resolver/bip_353/bip_353_record.dart';
+import 'package:cake_wallet/core/address_resolver/parsed_address.dart';
+import 'package:cake_wallet/store/settings_store.dart';
+import 'package:cw_core/crypto_currency.dart';
+import 'package:cw_core/utils/print_verbose.dart';
+import 'package:cw_core/wallet_base.dart';
+
+class Bip353AddressProvider extends AddressLookupProvider {
+ @override
+ AddressSource get source => AddressSource.bip353;
+
+ @override
+ List get supportedCurrencies => [CryptoCurrency.btc];
+
+ @override
+ bool isEnabled(SettingsStore settingsStore) => settingsStore.lookupsBip353;
+
+ @override
+ bool canHandle(String query) {
+ final value = query.trim();
+ return value.contains('@') && value.contains('.') && !value.startsWith('@');
+ }
+
+ @override
+ Future> resolve({
+ required String query,
+ required List currencies,
+ required WalletBase wallet,
+ }) async {
+ try {
+ final result = {};
+ String? dnsProof;
+
+ for (final cur in currencies) {
+ final bip353AddressMap = await Bip353Record.fetchUriByCryptoCurrency(query, cur.title);
+ if (bip353AddressMap == null || bip353AddressMap.isEmpty) continue;
+
+ final spAddress = bip353AddressMap['sp'];
+ final address = bip353AddressMap['address'];
+ final chosenAddress = spAddress?.isNotEmpty == true ? spAddress : address;
+
+ if (chosenAddress != null && chosenAddress.isNotEmpty) {
+ result[cur] = chosenAddress;
+ }
+ }
+
+ if (result.isEmpty) return [];
+
+ try {
+ dnsProof = await Bip353Record.fetchDnsProof(query);
+ } catch (e) {
+ printV('Bip353Record.fetchDnsProof error: $e');
+ }
+
+ return [ParsedAddress(
+ parsedAddressByCurrencyMap: result,
+ addressSource: AddressSource.bip353,
+ handle: query,
+ bip353DnsProof: dnsProof ?? '',
+ )];
+ } catch (e) {
+ printV('[address resolver] Error resolving BIP353 address: $e');
+ return [];
+ }
+ }
+}
\ No newline at end of file
diff --git a/lib/entities/bip_353_record.dart b/lib/core/address_resolver/bip_353/bip_353_record.dart
similarity index 59%
rename from lib/entities/bip_353_record.dart
rename to lib/core/address_resolver/bip_353/bip_353_record.dart
index 9a2a50e0a..257d76737 100644
--- a/lib/entities/bip_353_record.dart
+++ b/lib/core/address_resolver/bip_353/bip_353_record.dart
@@ -2,13 +2,9 @@ import 'dart:convert';
import 'dart:isolate';
import 'package:basic_utils/basic_utils.dart';
-import 'package:cake_wallet/generated/i18n.dart';
-import 'package:cake_wallet/src/widgets/alert_with_picker_option.dart';
-import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:dnssec_proof/dnssec_proof.dart';
-import 'package:flutter/material.dart';
class Bip353Record {
Bip353Record({
@@ -104,69 +100,4 @@ class Bip353Record {
}
}
- static Future pickBip353AddressChoice(
- BuildContext context,
- String bip353Name,
- Map addressMap,
- ) async {
- if (addressMap.length == 1) {
- return addressMap.values.first;
- }
-
- final chosenAddress = await _showAddressChoiceDialog(context, bip353Name, addressMap);
-
- return chosenAddress;
- }
-
- static Future _showAddressChoiceDialog(
- BuildContext context,
- String bip353Name,
- Map addressMap,
- ) async {
- final entriesList = addressMap.entries.toList();
- final List