* charts (wip)

* charts (wip)

* wip

* add asset grid

* split files

* logic wip

* proper getPrices logic

* viewmodel (wip)

* charts

* remove unused import

* remove restricted import...?

* fix background gradient when scrolling

* add safeguards for broken db

* save new pin on removal

* add safeguards for concurrency

* add haptic feedback

* fix haptic feedback

* fix fiat ticker

* reduce chart padding

* add line touch indicator

* improve touch target size on range selector

* add date/time display when viewing past amount

* merge

* remove iconSvgPath reference

* merge

* fix state for date display

* merge

* auto-reformat

* only load charts when page is opened

* merge

* reformat and apply lints

* refactor to use `Money` instead of storing amount in `String`

* add slop comment

* fix exception on division by zero

* ci

* workaround toDouble being removed

* disable strict parsing and rounding

* fix abs()

* use new currency picker sheet

* safeguard for max flutter-supported decimals

* fix amount precision

* adjust to new buy/sell

* Update lib/new-ui/pages/charts_page.dart

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

* adjust buy/sell di

* replace -> ignore

* reformat

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
malik1004x
2026-09-22 21:32:38 +03:00
committed by GitHub
co-authored by Omar Hatem
parent d38c748127
commit b88fbf32ae
94 changed files with 2544 additions and 270 deletions
@@ -13,8 +13,10 @@ import 'package:cake_wallet/entities/haven_seed_store.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/entities/secret_store_key.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/new-ui/model/charts/charts_asset.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:collection/collection.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/node.dart';
import 'package:cake_wallet/entities/sync_status_display_mode.dart';
import 'package:cw_core/node_list.dart';
@@ -648,6 +650,9 @@ Future<void> defaultSettingsMigration(
enabled: false,
);
break;
case 72:
await createDefaultChartsData();
break;
default:
break;
}
@@ -1338,6 +1343,12 @@ Future<void> _addXaut0TokenToExistingSolanaWallets() async {
}
}
Future<void> createDefaultChartsData() async {
await ChartsAsset(asset: CryptoCurrency.btc, isFavorite: true).insert();
await ChartsAsset(asset: CryptoCurrency.xmr, isFavorite: false).insert();
await ChartsAsset(asset: CryptoCurrency.eth, isFavorite: false).insert();
}
Future<void> _addTbbTokenToExistingSolanaWallets() async {
try {
final tbbToken = SPLToken(
+3
View File
@@ -19,6 +19,9 @@ class FiatCurrency extends EnumerableItem<String> with Serializable<String> impl
@override
final int decimals;
@override
String get apiString => "fiat.$title";
@override
final String symbol;
+1 -1
View File
@@ -82,7 +82,7 @@ class MainActions {
canShow: (viewModel) => viewModel.hasTradeAction,
onTap: (BuildContext context, DashboardViewModel viewModel) async {
if (!viewModel.isEnabledTradeAction) return;
await Navigator.of(context).pushNamed(Routes.buySellPage, arguments: false);
await Navigator.of(context).pushNamed(Routes.buySellPage);
},
);
}
+24 -24
View File
@@ -1,14 +1,8 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/material.dart';
import "package:cake_wallet/generated/i18n.dart";
import "package:cake_wallet/view_model/dashboard/dashboard_view_model.dart";
import "package:flutter/material.dart";
class NewMainActions {
final Key key;
final String Function(BuildContext context) name;
final String image;
final VoidCallback onTap;
final bool Function(DashboardViewModel viewModel)? isEnabled;
final bool Function(DashboardViewModel viewModel)? canShow;
NewMainActions._({
required this.key,
@@ -18,48 +12,54 @@ class NewMainActions {
this.isEnabled,
this.canShow,
});
final Key key;
final String Function(BuildContext context) name;
final String image;
final VoidCallback onTap;
final bool Function(DashboardViewModel viewModel)? isEnabled;
final bool Function(DashboardViewModel viewModel)? canShow;
static List<NewMainActions> all = [
homeAction,
walletsAction,
contactsAction,
appsAction,
//chartsAction,
chartsAction,
];
static NewMainActions homeAction = NewMainActions._(
name: (context) => S.of(context).home,
image: 'assets/new-ui/navbar/home.svg',
key: ValueKey('dashboard_page_home_action_button_key'),
image: "assets/new-ui/navbar/home.svg",
key: const ValueKey("dashboard_page_home_action_button_key"),
onTap: () {},
);
static NewMainActions walletsAction = NewMainActions._(
name: (context) => S.of(context).wallets,
image: 'assets/new-ui/navbar/wallets.svg',
key: ValueKey('dashboard_page_wallets_action_button_key'),
image: "assets/new-ui/navbar/wallets.svg",
key: const ValueKey("dashboard_page_wallets_action_button_key"),
onTap: () {},
);
static NewMainActions contactsAction = NewMainActions._(
name: (context) => S.of(context).contacts,
image: 'assets/new-ui/navbar/contacts.svg',
key: ValueKey('dashboard_page_contacts_action_button_key'),
image: "assets/new-ui/navbar/contacts.svg",
key: const ValueKey("dashboard_page_contacts_action_button_key"),
onTap: () {},
);
static NewMainActions appsAction = NewMainActions._(
name: (context) => S.of(context).apps,
image: 'assets/new-ui/navbar/apps.svg',
key: ValueKey('dashboard_page_apps_action_button_key'),
image: "assets/new-ui/navbar/apps.svg",
key: const ValueKey("dashboard_page_apps_action_button_key"),
canShow: (dashboardVM) => dashboardVM.showApps,
onTap: () {},
);
// static NewMainActions chartsAction = NewMainActions._(
// name: (context) => 'Charts', //TODO S.of(context).charts,
// image: 'assets/new-ui/navbar/charts.svg',
// key: ValueKey('dashboard_page_charts_action_button_key'),
// onTap: () {},
// );
static NewMainActions chartsAction = NewMainActions._(
name: (context) => S.of(context).charts,
image: "assets/new-ui/navbar/charts.svg",
key: const ValueKey("dashboard_page_charts_action_button_key"),
onTap: () {},
);
}